Posts Tagged ‘Using E-commerce’
E-commerce tracking using Google Analytics is likely the most useful feature of the program as it allows for in-depth analysis of important e-commerce metrics such as Revenues generated from products sold, specific product performance, conversion rates, average order value and more. If operating an e-commerce store, analysis of these metrics can result in significant performance gains as it makes it easier to understand customer behavior and areas for improvement. In order to plant the code, you will need access to your main web server hosting your web site coding in order to insert GA code where necessary. Remember, what we’re doing here is injecting information from your web server and funneling it to the GA server which spits out the data back to you in a form that is able to be accessed in a useful format. First, before any of these features can be utilized, the e-commerce feature must be enabled as shown below:
First Select Analytics Settings>Profile Settings>Edit Profile information>Enable E-commerce by selecting YES, an E-Commerce Site

Once E-commerce is enabled, GA tracking code must be added to your receipt page and then some additional code must be implemented to track and log each transaction. In order to track each transaction the following code must be implemented into the receipt page:
First add standard Google Analytics tracking code to the receipt page. This tracking code will vary based on your specific profile; however an example is as shown:
<script type=”text/javascript”>
var gaJsHost = ((”https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(”%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
</script>
<script type=”text/javascript”>
try {
var pageTracker = _gat._getTracker(”UA-7799676-1″);
pageTracker._trackPageview();
</script>
Next on the receipt page after standard ga.js tracking code enter the following code before </script> enter the following code: Note that your merchant software provider is required to dynamically retrieve information from the fields below:
pageTracker._addTrans(
“Order ID-required”
“Affiliation or store name-optional”
“Total-required”
“Tax-optional”
“Shipping-optional”
“City-optional”
“State-optional”
“Country-optional”
);
Next add pageTracker._addItem(
“Order ID-required”
“SKU/Code-optional”
“Product Name-optional”
“Category-optional”
“Unit price-required”
“Quantity-required”
);
Lastly add: pageTracker._trackTrans();
Finish code with </script>
The trackTrans() argument is vital because it sends all information to GA server and records the transaction giving you the data. Essentially the trackTrans argument sends the data from your server to GA by requesting for the _utm file twice, once for the transaction taking place and once for each item purchased.
An example of what the coding for the final receipt page should look like:
<script type=”text/javascript”>
var gaJsHost = ((”https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(”%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
<script type=”text/javascript”>
try {
var pageTracker = _gat._getTracker(”UA-7799676-1″);
pageTracker._trackPageview();
pageTracker._addTrans(
“Order ID-required”
“Affiliation or store name-optional”
“Total-required”
“Tax-optional”
“Shipping-optional”
“City-optional”
“State-optional”
“Country-optional”
);
pageTracker._addItem(
“Order ID-required”
“SKU/Code-optional”
“Product Name-optional”
“Category-optional”
“Unit price-required”
“Quantity-required”
);
pageTracker._trackTrans();
</script>
Repeat this procedure at the receipt page of each product sold. Remember that code will need to dynamically retrieve the fields from your merchant software
What your E-commerce Report Tells you:
After E-commerce code is processed and working properly, essentially what you will see is an in-depth analysis of different revenue metrics. Navigating through the left hand tabs allows you to sort through specific product performance, average order values, transactions, visits to purchase, and days to purchase information.


