How to configure ecommerce tracking in your Google analytics

If you have an online ecommerce presence and want to get the most out of it, doing so is more than just displaying items and having a purchase function. That will be a good starting point but as you grow and develop and use different techniques and strategies to increase throughput and sales, you want to know what is working and what to do more of. That is basic business acumen – online or otherwise. And that’s where Google Analytics can help. Google Analytics allows you to measure your advertising impact, track your multimedia traffic as well as your social networking and app traffic and usage. But one of the great things it can do is ecommerce site tracking. This enables you to measure the number of transactions and the revenue that your business website generates.

How does this work? Typically when an online purchaser clicks the ‘buy’ or ‘purchase’ button the user’s purchaser information is sent to the web server which carries out the transaction. When successful this usually redirects the user to a ‘thank you’ or ‘transaction complete’ page. Ecommerce tracking sends the data from this page to Google Analytics.

There are two types of ecommerce data that can be analysed via Google Analytics; transaction data and item data. The former represents the entire transaction that occurred on your site and includes values such as the transaction code or ID, the brand or store affiliation of the item, the total revenue from the sale, the shipping costs and any tax paid. The item data represents the individual products that were in the cart including the transaction ID, the item name, item code, product categories, price and quantity.

How to start? The default Analytics library does not include ecommerce tracking as standard so to set up ecommerce tracking you need to enable it at the view level or add the plug in. Enabling it is simple from the ADMIN button on the menu bar at the top of Analytics. Use the drop-down menus to select the Account, Property and View details, click View Settings and in the commerce settings section shift the toggle so that it says ‘on’. Click Save at the bottom of the page. It’s that simple.

Configuring ecommerce tracking can be technical so you may want some developer support in doing this. It can differ depending on the specific environment i.e. website tracking or mobile app tracking and whether your collection snippet is already using Universal Analytics or Google Analytics. For Google Analytics the general process is as follows and should be invoked in your ecommerce software in this order:

1.    Click Admin on the navigation bar.
2.    Select View Settings in the right column.
3.    Switch Ecommerce tracking to the on position.
4.    Save Setting.

1. Create a transaction object

Use the addTrans() method to initialise a transaction object. This stores all of the related information about a single transaction. This must include the Transaction ID.

2. Add items to the transaction

The addItem() method then tracks all of the information about the individual items in the online users shopping cart and associates the item with each transaction via the transactionId field (which is why we said it must be included in the transaction object).

3. Submit the transaction to the Analytics servers

Lastly, the trackTrans() method confirms that a purchase has actually taken place and off the data that has been accumulated up in the transaction object is finalised as a transaction.


Extracting the information from the ecommerce engine can be done in a number of ways. Some ecommerce engines write the information in a hidden format for retrieval, others store in a database and some do so in a cookie. All are easily accessible. With this data, you can make powerfully effective decisions on your ecommerce marketing strategy.

Posted on 30 Apr 2014