How to Track Ecommerce Transactions with Google Analytics

Posted on the 02 May 2013 by Butterchicken @vivekkrishnan

The bottomline of an online store is the number of sales. Fortunately for us, Google Analytics is a poweful software to track ecommerce transactions to see how well your campaigns are performing. The depth of data in Analytics is impressive and can allow a person to make the best business decision possible for their ecommerce store.

Google Analytics exclusively offers an ecommerce reporting which you can use for measuring metrics that are essential and/or specific to an online store. Here are some example of the types of metrics that you can measure using ecommerce reporting tab in the Google Analytics (GA) dashboard:

  • Transactions & revenue from Adwords campaigns
  • Transactions & revenue from third-party referral
  • Transactions & revenue from Organic sources
  • The total number of transactions on your site in a day or date range
  • The overall or campaign-wise or source-wise conversion rate on your site
  • The per visit value of your traffic

From above it is pretty clear that GA is an invaluable asset for your ecommerce endeavors.

Steps to Track Ecommerce Transaction with Google Analytics

Step 1

First off, you need to enable ecommerce reporting in your dashboard.

This is how you need to navigate once you login to Google Analytics: Go to Analytics Settings > Edit Profile Settings > Edit Main Website Profile  Information

The screenshot below will show you how:

Step 2

Google Analytics provides you with the necessary code snippet which you need to insert to your site. This code needs to go to the page where the visitor lands after successfully completing a transaction. For an ecommerce site, it is usually the thank you page where the visitor lands after his purchase.

So you need to add the code snippet to the thank you page so that it gets triggered every time a user will complete a transaction on your site. It ensure error-free tracking of all the orders that take place on your site.

Step 3

GA is an advanced tracking tool, it can not only record the number of transactions but it can tell you exactly which product was sold, the quantity, revenue generated and an Order ID or SKU that was associated to the product. These are vital metrics that Google Analytics can show you in your dashboard.

However, you need to add an extra bit of code to your original tracking. Be sure to check out the snapshot above for an easier understanding of the same. Below is an explanation on what these pieces of code actually do in your ecommerce reporting and how they work.

The “_addTrans()” method establishes a transaction and tracks the following: Order ID*, Affiliation, Total*, Tax, Shipping, City, State, Country. Your code will dynamically retrieve this value from your payment gateway to generate the above data.

Items that are transacted by the visitor, is called under the piece of code:  “_addItem()” and it takes the argument Order ID*, SKU/Code*, Product Name, Category, Price*, Quantity*.

Finally, the” _trackTrans” bit is responsible for sending the transaction data as well as the item data to the Google Analytics server.
Ensure that the ecommerce tracking code is called after the Google Analytics Tracking code calls “_trackPageview()”.

When https protocol is used for secured pages, if you use ga.js then Google Analytics Tracking code would automatically detect the same.

If you are using urchis.js code for GA tracking, you can refer to the following article: http://www.google.com/support/googleanalytics/bin/answer.py?answer=74984

In the article, values with an asterisk (*) represent required fields. Please feel free to ask questions regarding Google Analytics for ecommerce conversion tracking below!