How to Track Ecommerce Transactions with Google Analytics
Original Source: https://www.sitepoint.com/track-ecommerce-transactions-google-analytics-reports/
Other than custom Events (see the link above if you’re curious what Events are), we can also track ecommerce transactions in Google Analytics using some extra code.
Why Track Ecommerce Transactions in Google Analytics?
Most ecommerce systems offer detailed transaction statistics, but you can’t necessarily relate them to sessions, devices, demographics or other important metrics. For example, was an increase in sales caused by UX improvements, a successful marketing campaign, or seasonal variations? Who knows.
Recording transactions in Google Analytics means that:
product and user reports are richer and more insightful
you can relate transactions directly to AdWords and other campaigns systems
you can assess the success of campaigns and concentrate on those that lead to a high return on investment
you can award access to these reports to those in your company without having to add them to the ecommerce system.
Let’s dive in.
The Overall Concept
Typically, your users will add items to a cart, check out, possibly register, pay an amount, and then be redirected to a confirmation screen. The transaction details will then show up in Google Analytics, once the user has officially checked out.
How to Enable Ecommerce Tracking
Proceed to the Admin area (cog icon) on the left-hand side, select your PROPERTY (your website), and then select Ecommerce Settings. Switch the “Status” to ON.
Note: the Related Products feature was deprecated in April 2017, so avoid this entirely.
Enhanced Ecommerce Settings allows you to record product impressions, promotions and actions such as coupon usage. I recommend that you implement standard ecommerce tracking first, then consult the Enhanced Ecommerce Documentation when you want to move on to more advanced ecommerce tracking later down the line.
Finally, open the View Settings menu and change the Currency displayed as value if necessary.
Enable Ecommerce Transactions
Next, use this snippet to enable ecommerce transactions:
Note: this must be run after the page tracking snippet and before any ecommerce functionality is used.
Starting a New Transaction
Let’s look at each of the lines in this object individually …
The unique transaction identifier, e.g. ‘ABC-123’.
The affiliation or store name, e.g. ‘My Online Shop’.
The total cost including shipping and taxes. A string-encoded number without currency symbols must be used, e.g. ‘12.99’.
The (numeric) cost of shipping, e.g. ‘2.99’.
The (numeric) tax, e.g. ‘1.64’.
We already set up the default currency earlier, but you can alternatively specify a 3-character ISO 4217 country code such as EUR (Euros) or GBP (British Pound) if the shopper opts to pay using a different currency.
Adding Items to a Transaction
Items are added to an existing transaction with this snippet:
Again, let’s look at each of the lines in this object individually …
The unique transaction identifier, e.g. ‘ABC-123’. This must match the code used in the transaction above, to clarify that this item relates to the basket the user already has.
The product name, e.g. ‘mens blue shirt’.
A unique product code or stock-keeping unit (SKU), e.g. ‘MBS-00001’.
A category or variation, e.g. ‘mens shirts’.
The numeric price of this item, e.g. ‘9.99’.
The quantity purchased, e.g. ‘2’.
Clearing Items in a Transaction
Submit the Transaction to Google Analytics
Naturally, this would happen on the confirmation screen.
Continue reading %How to Track Ecommerce Transactions with Google Analytics%
Leave a ReplyWant to join the discussion?
Feel free to contribute!