The Fresh Egg blog
Latest digital marketing news
There are a number of issues with e-commerce tracking in Google Analytics that can potentially cause big problems for your reporting. In the latest blog post in our e-commerce series, we get to grips with some of the most common problems to be aware of when implementing e-commerce tracking, and tell you how to overcome them.
Read up on how to set up ecommerce tracking with Universal Analytics here. If you'd like to learn more about setting up classic e-commerce tracking, read our earlier blog post: How to set up e-commerce 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.
So, on with the problems:
If your e-commerce 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:
If the command "_trackTrans" is set more than once for the e-commerce tracking, it will send the e-commerce 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 e-commerce 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.
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 e-commerce tracking has been sent. Once the flag has been set, if the same confirmation page is hit again, ensure that the e-commerce 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.
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:
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.
Another cause of inflated revenue data is when e-commerce 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.
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:
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 e-commerce 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 e-commerce tracking, check out Google’s documentation for the asynchronous code, or the more recent implementation using Universal Analytics tracking code.
If e-commerce tracking is causing you trouble, please feel free to get in touch with one of our friendly experts.
If you want to know more about e-commerce in the meantime, check out one of the other recent posts about e-commerce and Google Analytics tracking: