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.
We wrote previously about how to set up ecommerce tracking with Universal Analytics. If you'd like to learn more about setting up classic ecommerce tracking, read our information on: How to set up ecommerce tracking in Google Analytics. If you want to get some hands-on learning then why not check out our analytics and Google Tag Manager training courses.
Here, we'll help you with the following:
- Seeing duplicate transaction data in Google Analytics
- Firing the ecommerce tracking code multiple times
- Missing transactions in Google Analytics
- Revenue can appear inflated in Google Analytics
- Omitting optional or empty fields can cause problems
- Using unit price incorrectly will skew revenue figures
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.
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 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
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.
6. Omitting optional or empty fields can cause problems
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:
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.