Now that you have installed the Google Analytics tracking code and are able to track any sub domains or other sites you may have, you are now ready to begin tracking the ecommerce transactions on your online shop.
If you have set up ecommerce tracking correctly on your website you will be able to report on what percentage of your sales are coming through to the site from your SEO or PPC campaigns and how much revenue you have made from these sources.
To do this you will need to be able to add the tracking code to any third party online payment tools including all steps of the checkout process and the receipt page.
On all pages of your checkout you need to have the standard Google Analytics tracking code (with the correct settings for cross domain tracking where needed) as on all the pages of your main site.
Once you have the core tracking code in place on all of your pages of your checkout you need to add the ecommerce tracking code.
Ecommerce tracking code sits on the receipt page of your website and sends information to Google about the number of products ordered, the value of all orders and the total revenue from the order.
For this information to be recorded you need to add information about the Order or transaction and also each item on the order. There are three commands which need to be added to the Receipt Page
_addTrans() is the transaction. This contains all of the information about a given order on your site such as the order number, postage and packaging costs, and total order value.
There are 8 variables in the Transaction code which are all separated by commas in the final code:
- Order ID – this is required
- Store Name
- Total Value – this is required
- Tax
- Shipping
- City
- State or Province
- Country
_addItem() allows information about each item ordered in the shopping cart – if the order being processed contains 8 items this _addItem command will be run 8 times, one for each individual item. Note however, that ordering more than one of an item does not need to be handled as different items as there is a quantity value.
There are 6 variables in the Item code which are all separated by commas in the final code:
- Order ID – required – this is the order ID as mentioned in the above _addTrans code
- SKU/Code – required- this is a unique product ID for each of the products from your inventory
- Product name – useful for reporting in Google Analytics
- Category or variation
- Unit price – required
- Quantity – required , as mentioned above this allows you to add multiple purchases of the same item in one addItem and not two.
The final command needed to process Google Analytics Ecommerce tracking is the _trackTrans command, this sends all of the data to your analytics.
For both the Item and the Order elements you have to allow space for all of the variables. However if you don’t want to show one of these you can leave it blank. For example in the below code the City, State or Province and Country variables are blank
_addTrans(“12345″,”my shop”,”45.99″,”9.18″,”3.99″,”",”",”");
A full version of the ecommerce tracking code is shown below:
![]()


