Google Anlaytics 4 discrepanices, traffic drop and accuracy
Google Analytics 4 despite being new stuff, proved to be hard to work with and has potentially steep learning curve. We're learning new stuff ourselves everyday so let's check the following stuff that could be causing incorrect reports.
In the following quick, we shall describe a few common points related to discrepancies between transactions in Magento 2 and Google Analytics 4.
Function-wise our extension is designed and working as per Google's specifications displayed here - https://developers.google.com/tag-manager/ecommerce-ga4, dataLayer[] object is initialized with all the required parameters and the payload that is being pushed for every event meets the requirements. Still, there are few things that could be causing missing or invalid data in your GA4 property.
1. LATENCY
Google Analytics 4 for has insane data latency, sometimes up to 48 hours or even more. If you've placed a test order today or yesterday, they might not appear yet in your reports.
2. TECHNICAL REQUIREMENTS
From technical perspective, the following things should be checked and verified
2.1 Check what version you have of Anowave_Ec4 module (check app/code/Anowave/Ec4/CHANGELOG.md). If lower than ## [100.4.3] - 17/05/2022, upgrade both Anowave_Ec and Anowave_Ec4 to latest versions.
2.2 Check if you have the following TAGS in your GTM container:
EE AdWords Dynamic Remarketing
EE4 Add Payment Info
EE4 Add Shipping Info
EE4 Add To Cart
EE4 Add To Compare
EE4 Add To Wishlist
EE4 Begin Checkout
EE4 Purchase
EE4 Refund
EE4 Remove From Cart
EE4 Select Item
EE4 Select Promotion
EE4 View Cart
EE4 View Item
EE4 View Item List
EE4 View Promotion
GA4 Configuration
2.3 Edit EE4 Purchase tag and check if ALL of the following Event parameters are set.
items
transaction_id
value
currency
shipping
tax
affiliation
Missing 'currency' parameter will cause revenue to show as $0.00 instead of the actual revenue.
2.4 DUPLICATE events/transactions
There are multiple reasons that could be causing this, I have described most common ones below.
I highly recommend this article - https://www.analyticsmania.com/post/duplicate-events-in-google-analytics-4-and-how-to-fix-them/
It describes most of the potential reasons for duplicate stuff.
3. VERIFYING & TESTING
Confirming that GA4 is tracking data properly is usually done by a combination of running GTM in Preview mode and setting GA4 in DebugView
To use the DebugView report:
3.1 Enable debug mode
To enable debug mode, edit GA4 Configuration tag and under Fields to set, add new field with Field name set to "debug_mode" and Value set to "true". Once done, publish the container
3.2 Observe events as they are tracked
To check events run GTM in Preview mode and then go to your Google Analytics 4 Property -> Configure > DebugView
You should see all events here the moment they fire on your site, you can now place a test order and see if the 'purchase' event is fired and if it has all the parameters required for successful tracking.
Transactions are tracked by the EE4 Purchase tag. Make sure that this tag appears in the list of fired tags on your success page. This will ensure that transaction data is sent to Google Analytics 4 successfully
4. VERIFYING & TESTING (AS A DEVELOPER)
In addition to stuff described in pt. 3 (see above), as a developer you can use the browser console to check if transactions are tracked properly.
4.1 To test it in the browser, hit F12 to display Developer Tools (in Firefox or Chrome)
4.2 Select Network tab which displays all network requests and type a manual filter e.g. "collect?v=" to filter Google Analytics 4 requests only.
4.3 Place a test order and inspect the network requests. There should be at least one POST request with the following headers:
pr1iddownloadable~nmDownloadable~br~qt3~pr2400~k0currency~v0USD~caProducts~k1item_category_2~v1Accessories
ep.debug_mode true
ep.transaction_id 000000060
epn.value 7220
epn.shipping 0
epn.tax 1200
ep.affiliation Default Store View