You've likely heard the term, but what exactly is e-commerce tracking? In short, it's a feature on Google Analytics that allows you to track online transactions on e-commerce websites. It provides detailed analytical data to help establish the right path to maximum ROI.
Ecommerce tracking even lets you see online traffic sources to improve your conversions. Doesn’t that sound exciting? It’s rather simple to enable your website for generating such information. All you need is a few extra codes. Of course, you also have to analyze the data presented to make the most of it.
Benefits of E-Commerce Tracking
Before understanding the benefits of tracking with Google Analytics, you must first be aware of the data that would become available. You'll be able to study the:
• Revenue generated by each of the products
• Total revenue
• Total number of products sold
• Quantity of specific products sold
• Rate of conversions
• Total transactions
• Number of unique purchases made
• Average price of products
• Average value of orders
• Date wise performance data
• Number of days and sessions leading to a transaction
Using the above facts and figures, you can easily gauge which products are selling well and which are flopping. Setting up e-commerce tracking will give you valuable insight into the effectiveness of your marketing efforts.
By knowing the exact revenue generated from each generation, you can get your sales in line with your expectations. For instance, if the revenue produced from each sale is less than you've been expecting, you could introduce discounts or set a minimum purchase clause.
This Google Analytics feature helps you get to know your returning customer base. You can then plan your specific re-marketing strategies to target them and enhance conversions. Thus, using the tracking data can accomplish a lot.
How Are Transactions Tracked?
Let's briefly look at the process depicted below to better understand how a transaction is tracked using Google Analytics.
Image credit: http://www.optimizesmart.com/
As you can see, the tracking involves:
• Completion of a transaction by the visitor.
• Processing in your eCommerce platform. This includes verifying the mode of payment, storing transaction details, generating the receipt page, inserting the transaction date into tracking code and loading the receipt for customer viewing.
• For the visitor, the transaction is complete and he or she will await the product's arrival. However, the moment the receipt loads on the customer’s browser, the tracking code sends data to the Google Analytics Server.
The receipt page is very important because it's where you need to add the tracking code. Through this, Google Analytics receives data from the transaction and stores it with other matrices. You'll then be able to analyze the conversion process and find innovative ways to increase ROI.
Implementing E-Commerce Tracking in Google Analytics
The First Step: Get a Google Analytics Account
This is quite simple. Do you have a Google Analytics account yet? If the answer is no, it’s about time you get one. If you already have an account, let’s move forward.
The Second Step: Enable Tracking in Google Analytics
Next comes enabling tracking in Google Analytics. You need to turn on the button meant for e-commerce tracking with these steps:
• Sign into your Google Analytics account.
• Choose the desired account.
• Go to the “Admin” tab from the top navigation.
• In the third column from left, choose “e-commerce" setting.
• Turn the “Enable e-commerce" toggle switch to “On."
This is optional, but you could also set the “Enable Related Products" toggle to “On.” Click on the "Next Step" It will ask for "Enhanced E-Commerce Settings." If you want to enable it, then toggle the switch to "On" or else click "Submit."
The Third Step: Add Tracking Codes
Now, it’s time to add the tracking codes onto your website's receipt page. Here is the Asynchronous Syntax recommended code by Google:
<title>Receipt of your purchase from Shoe Shop</title>
var _gaq = _gaq || ;
'9536', // transaction ID - required
' Shoe Shop',// affiliation or store name
'56.23',// total - required
'2.56', // tax
'Las Angeles', // city
'California', // state or province
'USA' // country
// add item might be called for every item in the shopping cart
// where your ecommerce engine loops through each item in the cart and
// prints out _addItem for each
'9536', // transaction ID – required
'DD44', // SKU/code - required
'Nike Shoe', // product name
'Sport Medium', // category or variation
'56.23',// unit price - required
'1' // quantity - required
_gaq.push([' _trackTrans']); //submits transaction to the Analytics servers
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script'); s.parentNode.insertBefore(ga, s);
Thank you for your order.You will shortly receive an email containing all your order details.
Note 1: It's necessary to add the codes in the receipt page only using all required fields.
Note 2: Make sure that website visitors aren't able to access the receipt page directly without making a purchase. Failing at this will skew your e-commerce stats.
The tracking process starts with the initialization of transaction objects by using method _addTrans() in the script. The main goal of the transaction object is to store data related to the transaction. This can include facts like billing address, charges for shipping, and transaction ID.
Syntax: _addTrans(orderID, store name, total revenue, tax, shipping, city, state, country)
Here’s an example:
Note: All items purchased during this transaction must have the same ID.
Next, you'll need to add items to the transaction. This is achieved by utilizing the _addItem() method. Remember that the information collected so far is limited to the transaction and won't include individual items. Therefore, this step is focused on gathering product information, such as stock keeping unit (SKU), total quantity, price, and item category. _addItem() is utilized to store data about the product purchased in the visitor's transaction.
Syntax: _addItem(orderID, Product-SKU, Product-Name, Product-Category, Product-Price, Quantity)
Here’s an example:
All that's left now is to submit the data collected into the Google Analytics Server. This is accomplished through the _trackTrans() method. _trackTrans() occurs only once the transaction is actually completed. Of course, interpretation of the transaction tracking data will depend on the engine that you choose. Good ones will significantly simplify the data before presenting it to you. Rest assured that almost all e-commerce engines recognize and accept Google Analytics data though.
Here’s how the _trackTrans() method works:
_trackTrans() is utilized to send e-commerce tracking data to Google Analytics via an invisible _utm.gif file. The file is requested in two instances:
1. Each visitor’s transaction
2. Each unique product
Note 1: The _trackTrans() method should always be called after the following methods: _trackPageView(), _addTrans(), and _addItem() methods.
Note 2: The use of _trackPageView() will associate the purchase with the page titled something like “Receipt of your purchase – Shoe Shop”
Note 3: The _gaq is a global object that can be used directly for an asynchronous page tracking with the push (...) method.
Collecting Meaningful Analytics Data
Google Analytics has the power to steer your business in the right direction if it's veering towards the wrong path. Yet, you'll need data that's meaningful without any room for ambiguity to ensure this holds true. Keep in mind that Analytics will churn out only data that's supplied to it. Don't forget the following handy tactics.
[Tweet "Make sure your Google Analytics e-comm data is meaningful."]
• The argument list for both _addItem() and _addTrans() is correspondent to position. Certainly, you don’t need all of the arguments, but supplying empty placeholders for arguments that aren't specified is vital. This will prevent calculation errors. For instance, you could add an item that contains quantity, place, SKU, and transaction ID in this manner: _addItem("9856", "684", "", "", "95.61", "1");
• SKU codes are a must for every item in the transaction. When the SKU isn't provided for all items, then GIF request would only be requested for the last product containing a SKU. Also, if the same SKU is assigned to multiple products, the e-commerce tracking data would only be available for the one added most recently. Your analytics will be skewed in both cases because all transaction purchases wouldn't be accounted for.
• Currency conversions ought to be handled before sending the data to the Google Analytics server. The “Price” and “Total” parameters don't follow any currency formatting. Without currency formatting, the parameters consider the period (.) and comma (,) as fractional value. Unless handled by your eCommerce platform's software, the e-commerce tracking data sent to Analytics will consider 44,550 dollars as $44.55 which will end up by supplying very wrong input.
Consider all of these aspects while implementing e-commerce tracking in your Google Analytics account. Then, you'll be less likely to miss anything about your purchases. [create-campaign destination_url="https://www.semrush.com/academy/courses/ppc-fundamentals-course-with-joel-bondorowsky/?utm_source=academy&utm_medium=blog_ecommerce_tracking_ga&utm_campaign=trial-banners_ppc_fundamentals" show_input="false" header="Learn the basics of PPC advertising" text="PPC Fundamentals Course with Joel Bondorowsky" button_text="Enroll for free" bg_images="https://static.semrush.com/blog/uploads/media/54/02/540217b5b95f1223e832ebbd4cfb6986/banners-5.png" bg_button="-warning"]
E-commerce tracking is a rather complex subject for website owners to understand and implement. Tracking mechanisms typically vary greatly from one business to another. If you're struggling with an e-commerce tracking problem, I'd love to lend a helping hand. Simply leave me a message in the comments section below. I'll get you out of your coding misery in no time. Happy tracking!