-
-
Notifications
You must be signed in to change notification settings - Fork 437
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
GA4: purchase event wrong #3228
Comments
getBasePrice and getBaseDiscountAmount are already floats, while quantity could also be decimal so we can't cast it to int |
In my testing the items |
can you try #3231? although I have the same kind of code on a live store and it works fine |
mmmm it is true that $item->getBasePrice() does return a string instead of a float (although it's documented otherwise)... |
You said you have this running on a client, can you confirm (if you have access to the GA account) that the conversions are empty? Or maybe Google is graceful (enough) that it does the typecasting for us? Sadly I cannot test the PR on our site, since I am in the process of implementing it myself and all my ways of adding a "event purchase" so far have failed (atleast are not visible). Not sure whats going on, hence my first idea the typejuggling thingy here. |
conversions are NOT empy for my customers, although I'm using an older implementation of the GA4 PR, since it was the one that I then ported on the core. the data are aggregated at least 24 hours later, if it is a new implementation. |
Ok, thanks for clarifying. Which then means that some error is on my side and the original PR works just fine (?). I have something like this running locally now, will report back when Google shows me the data. fingers crossed |
what is the error you're getting? |
it would seem very weird anyway that a type cast invalidates the tracking in analytics, they will for sure try to cast on their end not to lose any transaction data, I think. |
The 'error' is I am getting no purchase data. But then again, it may be because of our implementation. // Edit |
Update: Seems like google is gracefully parsing the values anyways. So I think its best to close this issue. |
PR #3092 introduced the usage of the purchase event trigger for GA4, however I believe its not fully functional.
Preconditions (*)
Steps to reproduce (*)
shipping
,tax
andvalue
and for theitem
, theprice
andquantity
should be of number format.number_format
)Expected result (*)
Actual result (*)
Fix would be to cast the values of
value
,shipping
andtax
viafloatval
to a float value.magento-lts/app/code/core/Mage/GoogleAnalytics/Block/Ga.php
Line 212 in 4e9520c
and here
magento-lts/app/code/core/Mage/GoogleAnalytics/Block/Ga.php
Lines 224 to 226 in 4e9520c
(
int
cast forquantity
andfloatval
forprice
anddiscount
)The text was updated successfully, but these errors were encountered: