8 common problems with ecommerce tracking in Google Analytics

There are several issues with ecommerce tracking in Google Analytics that can potentially cause big problems for your reporting, we explain how to correct these.

There are a number of issues with ecommerce tracking in Google Analytics that can potentially cause big problems for your reporting. In the latest blog post in our ecommerce series, we get to grips with some of the most common problems to be aware of when implementing ecommerce tracking, and tell you how to overcome them.

1. Amounts over 1,000 can confuse JavaScript


If your ecommerce site regularly receives transactions with the cost or quantity of an order over 1,000 (whether that’s pounds, dollars, pairs of jeans, sweets, anything), this common problem is something you should be aware of. When writing numbers to a web page, some coding languages will automatically add a comma to support localised number formats if the value is over 1,000. For example, 1684 would be written as 1,684.

This has been known to cause problems when sending the data to GA, as JavaScript will have issues parsing a number which contains a comma, unless it is specified as a string. To avoid this issue, you need to ensure that numeric values do not contain a comma when the data is sent to Google Analytics.

An example of how to do this when coding in C# is as follows:

2. Seeing duplicate transaction data in Google Analytics


If the command "_trackTrans" is set more than once for the ecommerce tracking, it will send the ecommerce data to GA every time the command is called. Therefore, it is vital to ensure that "_trackTrans" is only called once per transaction when implementing ecommerce tracking. The only exception to this rule is when data is sent to more than one property: the main reporting property, as well as a rollup profile on a separate property, for example. In this case, the “_trackTrans” call should fire once for every property.

3. Firing the ecommerce tracking code multiple times


It's not uncommon for the user to refresh the confirmation page or to save it as a bookmark after they have made a transaction. This can present a challenge as the same transaction data is being sent to GA every time the confirmation page is loaded, meaning that duplicate results may appear in the reports. A way to resolve this is to set a flag once the ecommerce tracking has been sent. Once the flag has been set, if the same confirmation page is hit again, ensure that the ecommerce tracking is not sent to Google Analytics.

To set a flag for a transaction, you’ll need to add a new field (let’s call it “TransactionFlag”) in the site database table that stores the transaction records. When the customer sees the confirmation page for their transaction, the application will check to see if the “TransactionFlag” field has been marked for that transaction already. If it hasn’t, the transaction information will be sent to GA and the “TransactionFlag” field for that record will be marked. If the customer then refreshes or revisits their transaction confirmation page, the “TransactionFlag” field will be picked up on, the code which sends the transaction data to GA will be hidden, and therefore GA will not receive multiple copies of the same transaction data.

4. Missing transactions in Google Analytics


It is not uncommon for transactions that are reported in the shopping admin panel to be missing from GA. GA is a trend analysis tool, and as such cannot be expected to be 100% accurate. However, if the variance is greater than 5%, you probably have an issue with the tracking code. This could be for a number of reasons:

  • The user who made the transaction had his or her JavaScript turned off
  • The user has left the page before the transaction has had chance to send to Google Analytics

If more than 10% of transactions are missing from GA, then there is likely to be a bigger issue and this should be investigated by running a number of test transactions with a debugger like Fiddler to ensure the right data is sent to Google Analytics every time.

5. Revenue can appear inflated in Google Analytics


Ecommerce revenue in GA should be used as a guide only. GA can support removing transactions, but this involves firing additional JavaScript. Unless an online shop supports this feature, some of the transactions listed in GA may have been cancelled, leading to inflated revenues.

Another cause of inflated revenue data is when ecommerce tracking is use to track checkout features like ‘reserve in store’, where visitors do not pay online but in-store after inspecting the item and deciding whether or not they want it.

Google Analytics health check and audit

How to conduct a Google Analytics health check

Download your FREE template, then use our step-by-step guide and use in tandem to complete the health check

6. Omitting optional or empty fields can cause problems


When implementing ecommerce tracking, a large number of fields are optional, for example, the category for an item object. This can lead to these fields being excluded as part of the JavaScript code. If any of the fields in an object are excluded, it is likely to cause problems sending the ecommerce data to Google Analytics. Fields still need to be included as part of the JavaScript code, even if a value is not specified. This ensures there are no issues in the ecommerce data being sent to Google Analytics.

In the below example, the category is missing completely from the item object. This is the wrong way of doing it and will cause problems:

The right way to do it is to include the category as an empty string:

7. Using curly quotes instead of straight quotes can cause JavaScript errors


Some programs, like Microsoft Word, like to use curly quotes ‘, instead of straight quotes '. When using curly quotes to separate each item in an object, there is likely to be a number of JavaScript errors. This will mean that the ecommerce data will not be sent to Google Analytics.

8. Using unit price incorrectly will skew revenue figures


The unit price is the cost of buying one item, not the total cost of any multiple of any one item bought in a single transaction. Confused? It’s not as bad as it sounds, we promise.

For example, a pair of jeans on an ecommerce website costs £19.99. The unit price of that pair of jeans will always be £19.99, no matter how many pairs of jeans a customer buys in a transaction. If a customer buys two pairs of jeans, the total money spent on those jeans will be £39.98, but the unit price will still be £19.99.

GA works out the total price for the items bought in a transaction by multiplying the unit price of an item by the quantity of that item purchased. That’s why it’s so important to ensure that the unit price field is being populated correctly.

For detailed information on how to set up or trouble-shoot your ecommerce tracking, check out Google’s documentation for the asynchronous code, or the more recent implementation using Universal Analytics tracking code.

If ecommerce tracking is causing you trouble, please feel free to get in touch with one of our friendly experts.

Do you have a analytics or data challenge we can help you with?