Default Banner

Add E-commerce Analytics for Better Business

The Future of e-commerce

The future of e-commerce is mobile. It lives in tablets and smartphones. There shouldn’t be a retailer out there who doesn’t know this to be true. But a new study by the mobile services provider Zmags (Mobile and Tablet Ecommerce: Is Anyone Really Ready?) found that only one-third of the top U.S. online retailers are even optimally ready for mobile e-commerce. Two-thirds of top U.S. retailers currently overlook this market opportunity. Neither are they ready for today’s shoppers using tablets and smart phones, nor can they identify new, incremental sources of traffic and conversions.

Welcome to e-commerce Tracking

If you want to effectively analyze online business performance you need transaction data. It’s vital. Measuring metrics like conversion rates is all well and good, but measuring revenue truly captures a business owner’s attention. To make the analysis simple, include e-commerce data in your web analytics application.

How e-commerce Tracking Works?

e-commerce_trackingImage Source

  1. A website visitor completes a transaction.
  2. Your e-commerce platform:
  • processes the transaction (verify credit card details etc)
  • stores transaction details
  • creates a receipt page (generally ‘thank you’ page)
  • inserts e-commerce data into ‘Google Analytics e-commerce tracking code
  • sends receipt page to the visitor’s web browser
  1. As soon as the page is loaded into the visitor’s browser, the Google Analytics e-commerce tracking code is executed and sends the e-commerce data to the Google Analytics server.


How to Set up e-commerce Tracking in Google Analytics

Step 1: To activate e-commerce tracking

You must first enable e-commerce reports. Log into GA and edit the profile settings. To activate the e-commerce reports, specify that your site is an e-commerce site.

activate_trackingImage Source

Unless you have an international site, you won’t find much use for the other e-commerce settings. For example, you can specify one of 25 different currencies and the number of decimal places you want displayed. Even if you use USD you can specify 3 decimal places. By Default, e-commerce tracking is set to “off”. In order to track a transaction on GA activate e-commerce tracking at a profile level.

Step 2: Tag your receipt page

Make sure you add the GA tracking code on your receipt page. The e-commerce tracking code is stored in the ga.js and if this file is not included on the receipt page you can’t track transactions.

Step 3: Install the code

Code construction: the hard part. GA uses a JavaScript collection technique to track e-commerce transactions. Your server code must inject transaction information into the GA JavaScript before sending the receipt page back to the browser. When the receipt page renders in the visitor’s browser the JavaScript executes and sends the transaction info to GA.

code_constructionImage Source

Here’s the code:

< script type=”text/javascript” >
“order-id”, // required
“affiliate or store name”,
“order-id”, // required
“product name”,
“product category”,
“unit price”, // required
“quantity” //required
< /script >

There are three distinct parts to the JavaScript, and each is a different method. The first section, identified by the _addTrans() method, creates the transaction and stores all the information about the transaction. The second section, identified by the _addItem() method, is used to add an item to the transaction. You need to create an_addItem() section for each separate item, or SKU, in the transaction. The order ID in the _addItem() method must be the same order ID used in the _addTrans() method. That’s how GA ties an item to a transaction. The final section, the _trackTrans() method, sends the data to GA by requesting the __utm.gif file once for the transaction and once for each item in the transaction. So if you have 3 different SKUs in a transaction there will be 4 requests for the __utm.gif.

The JavaScript shown above can appear anywhere on your receipt page. But make sure that it appears after the main GA page tag because the e-commerce code is part of the pageTracker object. Just to reiterate a point: you must create server side code that outputs the transaction data in the above format. If you do not have access to your shopping cart code, and if your cart provider does not provide e-commerce tracking, you may be out of luck.

Once the code has been installed you should begin to see e-commerce data in your GA.

What Data can be Tracked?

Google Analytics collects two types of e-commerce data: transaction data and item data. Transaction data describes the overall transaction (transaction ID, total sales, tax, shipping, etc.) while item data describes the items purchased in the transaction (sku, description, category, etc.). All of this data eventually ends up in GA reports.

The complete list of data includes:

 Transaction Data

  • Transaction ID: your internal transaction ID [required]
  • Affiliate or store name
  • Total
  • Tax
  • Shipping
  • City
  • State or region
  • Country

Item Data

  • Transaction ID: same as in transaction data [required]
  • SKU
  • Product name
  • Product category or product variation
  • Unit price [required]
  • Quantity [required]

A few notes about the data:

  • Geo-location data is no longer used by Google Analytics. The new version of GA identifies where the buyer is located using an IP address lookup.
  • You should avoid using any non-alpha numeric characters in the data, especially in the numeric fields.
  • Do not add a currency identifiers (i.e. dollar sign) in the total, tax or shipping fields. This can cause problems with the data.

Contact us to learn more about how analytics can improve your business.

Team Position2

December 10, 2014

By Team Position2