Top 10 Ecommerce Tracking Issue Fixes: Is Your Code Not Working? Data Discrepancy? & More…

Ecommerce Tracking Issues

Last Updated on October 11, 2020 by Ritwik B

Enhanced ecommerce implementation is as not as easy you think. Once you start implementing it, you’ll face 100s of issues.

I know you have been there… that’s why you are here!!! And Yes… This list will help you fix those issues in no time.

Most of the issues as far as I’ve seen fall into 2 categories

  1. Pre-Implementation: Data not getting sent, Code Issues, etc
  2. Post-Implementation: Data discrepancy, Some/All Reports not getting populated, etc

 

I kid you not, but taking decisions based on flawed data can be disastrous. So, it’s important even after fixing the issues, you’ll need to VERIFY the data for at least for 2 weeks or a month before you start making decisions.

Here, we’ll focus on the 15 issues that most users face while implementing enhanced ecommerce or ecommerce tracking.

Note: Please do comment on any other issues that I might have missed.

Let’s get down to the list

10 Lists Of Ecommerce Tracking Issues & Fixes

1.) JS Errors: Missing Commas, Semicolon, Curly Braces & More

If you don’t see the data getting sent to google analytics via hit, then you might have JS errors in your code. Make sure to check your code for

  • Missing Commas, Curly Braces, colons, etc
  • Spelling Errors
  • Syntax errors: for/while loops, etc
  • Correctly Populated E-commerce Object.

One negative thing about JS is it will not execute the code if it finds any error & worse than that it will NOT even show where the error has occurred…

The workaround would be to use try/catch block around the code to debug any errors. Here’s a great article for JS enthusiast on how you can handle errors.

After the error has been fixed make sure to check the hit request via browser network tab or google analytics debugger.

2.) Missing REQUIRED Ecommerce Object Attributes

This might be the one…

Do check if you have missed any REQUIRED attribute from the enhanced ecommerce code.

According to the documentation, here are the required attributes

Product Impressions/Product Click/Product Details/Add|Remove Cart/Promotion Impressions.:

  • id
    OR
  • name

 

Transaction Data Code:

  • Transaction id
  • Product Name Or Product ID

 

I would suggest adding the following attributes for product & action object during a transaction:

Action Object

  • id
  • revenue

Product Object

  • id
  • name
  • quantity
  • price

3.) WRONG ordering of the code: analytics.js/gtag.js

You need to preserve the ordering while implementing the code. Only send the pageview/event hit after the ecommerce plugin is loaded.

Here’s an example for the transaction code in enhanced ecommerce via analytics.js:

ga('create', 'UA-XXXXX-Y'); //Step - 1: Create Tracker
ga('require', 'ec'); // Step - 2: Load Ecommerce Plugin

ga('ec:addProduct', { // Step 3: Add product & transaction info
'id': 'P12345',
'name': 'Android Warhol T-Shirt',
'category': 'Apparel',
'brand': 'Google',
'variant': 'black',
'price': '29.20',
'quantity': 1
});

// Transaction level information is provided via an actionFieldObject.
ga('ec:setAction', 'purchase', {
'id': 'T12345',
'affiliation': 'Google Store - Online',
'revenue': '37.39',
'tax': '2.85',
'shipping': '5.34'
});

ga('send', 'pageview'); // Step - 4: Send transaction data with initial pageview.

Follow These Steps:

  1. Create a tracker
  2. Load Ecommerce Plugin
  3. Load transaction & product information
  4. Send Pageview

4.) GTM Trigger & Variable Errors

If you are using GTM to fire enhanced ecommerce code then make sure you check if the ECOMMERCE object is populated CORRECTLY in the GTM variable. There are 2 ways to populate the GTM variable:

  1. DataLayer Method (recommended)
  2. Custom Javascript Macro

 

While most of you might have implemented the dataLayer method, make sure you populate the dataLayer with ecommerce data before the pageview. (if GTM trigger = pageview)

If ecommerce data is populated after the pageview event (gtm.js), you can use custom events to fire ecommerce tags. simply pass additional “event” parameter as described in the here.

dataLayer.push({
'event':'transaction_success',
'ecomm_data':
   'ecommerce': {
       'purchase': {.....

 

Now, You can finish the setup by doing the 2 things below

  1. Create the analytics event tag & fire it on the event “transaction_success“.
  2. Create & Pass GTM dataLayer variable named “ecomm_data” as enhanced ecommerce feature dataLayer variable in the tag.

 

Lastly, Do check for the spelling errors if variables are not getting populated.

5.) Third Party Checkout Issues

If you are using third-party checkout, make sure you follow these 3 things

  1. Implement the same base code (GTM or analytics.js/gtag.js) across both the sites.
  2. Exclude Referral domain for the checkout page.
  3. Implement Cross-Domain Tracking. (via GTM or analytics.js/gtag.js)

This will make sure that you don’t count multiple sessions of the same user. You can fire the code when the user successfully completes the transaction & lands on your thank you page.

6.) Transactions Attributed to Payment Gateway (source/medium == paypal, etc)

As per our last point, for the third party checkouts make sure to exclude their domain in the referral domains section.

Always try to exclude the main domain rather than a subdomain. So if you exclude infusionsoft.com it will also exclude all its subdomains. (app.infusionsoft.com, pay.infusionsoft.com & so on…)

Remember that once you exclude the payment source domains, the effect will take place after the settings are saved. So still you might see the payment gateway sessions as the past users have the campaign cookie stored for 6 months.

But yes….that will decline in a while.

If you’re using GTM, then do check out this small trick by Simo to exlcude the referrals.

7.) Transactions Discrepancy: Duplicate Transactions Issue - Inflated Revenue

You’ll face this issue if you have implemented the ecommerce code when user lands on thank you page.

The only problem with this setup is when the user lands on the thank you page for the 2nd time, the same transaction code will fire again resulting in inflated metrics. This might happen:

  • If you have sent an email with a link to the thank you page resulting in the user clicking on the link via different device or browser.
  • User refreshes the page
  • Users bookmark the page & open it later
  • & so on…

 

Some of the possible solutions would be

  1. Implement the code on the server side such that the transaction ID gets sent only once. (recommended)
  2. If you’re using GTM, modify the trigger & add referrer as the payment gateway or the previous page to thank you.
  3. Store the transaction id as a cookie in the user’s browser & use it as a trigger to fire the ecommerce code. (if cookie not present then fire it). You can check the below sources for the step by step implementation:
    Sources: https://www.thyngster.com/preventing-duplicate-transactions-in-universal-analytics-with-google-tag-manager/
    https://www.simoahava.com/gtm-tips/prevent-repeat-transactions/

8.) Transactions Discrepancy: Missing Order IDs Issue - Low Revenue

This issue is faced by lots of users who have implemented the ecommerce setup CORRECTLY.  Yes, even if you have set up everything as per the google docs, there is a very high chance that your data will never match with your CMS data.

Remember, Google Analytics will never give you EXACT revenue or transaction data if you have large number of transactions per day.  There are many reasons for this discrepancy & the most we can do is minimize it.

Here are some of the known reasons:

  1. The user has opted out of analytics tracking.
  2. The user is using some browser blocker.
  3. Too much information in a single hit. (check google analytics limitation)
  4. Timezone discrepancy between CMS & Google Analytics reports.
  5. Delay in data processing that might cause the transaction to show hours later.

Also, check the reasons mentioned in the google docs.

#1 Users Not Landing On Thank You Page

If your unique pageviews are nearly equal to the number of transactions then there might a case where the users are not redirected to the thank you page. This might happen when

  1. The user selects a different payment method. (COD or PayPal or credit/debit & so on…)
  2. The user makes a payment after the failed transaction.
  3. The user chooses “checkout as guest” which might have different thank you page.
  4. Some redirection issue on thank you page.

Make sure you go through every possible USE CASE to debug the discrepancy. Also, do check the CMS docs for more information.

 

#2 Users Landing On Thank You Page But Code Not Firing In Some Circumstances.

The better way to analyze this situation is to check the analytics reports for MISSING transactions. If they were from

  • A particular device. (Mobile? Tablet?)
  • A particular Browser.
  • App or website?
  • Payment method was COD
  • Users who did guest checkout.
  • & so on…

Once you find it, you can fix & reduce the discrepancy. Most of the time these are technical issues.

9.) Multiple Currency Issue: Local & Global

If you have an e-commerce store selling in multiple currencies, make sure you follow 2 things:

  1. Set the global currency in your Google Analytics. (default is USD)
  2. Set your Local currency parameter in your ecommerce code.

This will result in google analytics converting local currency into global currency with the previous day’s exchange rate.

Note: The Changes in currency settings will be applied to the data retroactively. So, the old currency data will never change even if you edit the global currency.

You can set the local currency by applying the “currencyCode” parameter. Check the google docs for multiple currency .

10.) Missing Data in Some Of The Ecommerce Reports.

Your implementation will define what all metrics & dimensions will get populated.

If not all, make sure you implement the ecommerce purchase code which will populate the metrics such as

  • Revenue
  • Shipping
  • Tax
  • Quantity
  • Avg. Order Value
  • Transaction ID
  • Product Name/SKU
  • & so on…

 

You can also implement other codes such as product impressions/clicks, promo impressions/clicks, Add to cart & checkout funnel to populate

  • Product List Views
  • Product List Clicks
  • Product List CTR
  • Product Add To Cart
  • Product Checkout
  • Checkout Funnel Steps
  • & so on…

If some metric is not getting populated then do check the respective attributes in the ecommerce object.

Ecommerce Tracking Troubleshooting Tool

One of the best ways to debug is to use google’s e-commerce troubleshooter. The issues are categorized as:

If you’re facing the issues mentioned above, definitely give it a try.

Ecommerce_Troubleshooter

Final Thoughts

According to the Google Analytics Community,

2.5% – 5% Transaction Discrepancy is acceptable. Anything beyond that needs to be fixed.

If you have followed all the point, make sure to fix any issues. Also, you can use tools like browser console, Analytics debugger, GTM debugger & so on to pinpoint the exact problem.

Lastly, do comment or message me in the chat, if you are facing other issues or I have missed anything. I’ll try to reply as soon as possible

Ritwik is a Web Analyst & Product Marketer. He loves to write technical & easy to understand blogs for Marketers & Entrepreneurs. Focused on Google Analytics, Facebook Analytics, Tag Management, Marketing & Automation Scripts & more. Google Certified Professional. A Firm Believer in Teaching -> Learning -> Growing. :)

Leave a Reply

Your email address will not be published. Required fields are marked *