-
-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added decimal/thousand separator specification when sending Analytics4 data #3366
Conversation
Makes we wonder why we still not send the 'correct' data type to google. What if we take a look at other shops GA4 implementation and see what we can see? |
why are you saying we don't send the correct data types? |
Do you remember #3228 ? |
If only I had the memory for all the PRs 😅 anyway that's been solved, right? |
at the end of the day we're sending a json so the typing is kinda loose. yes the values are within quotes but I don't think that's a problem for google. and I can't find any documentation for that "Number" data type. |
Yes, but we also don't have examples (do we?) by Google that shows how to properly seperate prices in their thousands or more. So again, good faith that it works. Right? |
there are some examples in the doc, but the prices shown are smaller than a thousand. I am sure that the number_format of this PR works, the "," as thousand separator I've many doubts. |
i'm testing the two formats version
tomorrow i can say if change something / is irrilevant / or whatever.. i don't think google check data type in json if is float or string |
There is a debug mode but you will see that the data looks a-like. |
There's another problem here, the "add_product_to_cart" doesn't pass the added quantity, there are cases where the website has a minimum quantity, so the current implementation is wrong. |
but sales_quote_add_item event is fired if minimium qty is not met? track qty in add_to_cart is not supported in current implementation cause the observer save only product id that will be catched in observer |
it doesn't actually matter if it's fired of not, the observer doesn't carry the quantity data so I think google assumes it's "1", which is wrong |
ok so a possible solution is to store in session key pairs |
I think it would be better to store the quote_item, it least we don't need another catalog/product->load() also, that event is not fired correctly for the project I'm working on (ajax add to cart modules), so I'd explore checkout_cart_product_add_after and/or sales_quote_product_add_after |
when product price is higher than a thousand EUR, it gets sent to analytics this way:
"currency":"EUR","value":"4,245.42"
This PR removes the thousand separator, so that it gets sent this way:
"currency":"EUR","value":"4245.42"
This PR also adds "quantity" to the begin_checkout data, which was missing.