Closed JoostWan closed 8 months ago
Am getting Google Analytics cookie version differs from Measurement Protocol API version
when an order has been placed. I checked the cookies _ga and this is what i see
My cookies are also in this format: GA1.2.123456789.1234567890
That means $gaCookieVersion
= GA1
. But the GA Clientversion is hardcoded to 4, so that will indeed never match.
That seems to be described here also: https://www.optimizesmart.com/google-analytics-cookies-ultimate-guide/
@barryvdh We created more changes for this module and testing it on some clients. You needed also the session_id otherwise the transactions can't related to a previous session in GA4.
PR in https://github.com/elgentos/magento2-serversideanalytics/pull/21 Can you try?
@JoostWan Oh sorry, only see your message now. Can you create a (draft) pull request or send the diff/patch? Then I'll test as well.
@barryvdh I will create a pull request later this week. Need to remove the UA from the code also because it's not needed anymore.
Yes, we Will try it also then! Nice work! Very much appreciated!!
@barryvdh @WouterSteen Can you check if it is working properly on your end as well?
https://github.com/elgentos/magento2-serversideanalytics/pull/22
I guess we can close this issue now, judging from #22.
The Client ID is retrieved from the Cookie
_ga
.The prefix is
GA1
but the part of the code does the checking for GA4 and UA1. So there is no match and the code returns null. Now the module created a random Client id and the data is Google Analytics is wrong because the conversion uses a different client id then the original from the visitor session.@indykoning maybe you can check this out, I saw the addition came from you
https://github.com/elgentos/magento2-serversideanalytics/blob/master/Observer/SaveGaUserId.php#L132
Some info;
https://louder.com.au/2022/06/27/client-id-in-ga4-what-is-it-and-how-to-get-it-in-your-report/
We created a simple patch for testing with some clients and it's working.