Web Analytics

Advanced Google Analytics E-Commerce Tracking – Just in Time for the Holidays!

If you’re an e-commerce business using Google Analytics, chances are you’ve already installed e-commerce tracking. At a basic level, e-commerce tracking is great because it allows you to see your online revenue right in Google Analytics, where you can segment it by campaign, by region, etc. However, most people simply do the standard e-commerce implementation and leave it at that. Today, I want to show you an easy way to make Google’s e-commerce tracking far more actionable. 

Conceptually, tracking transactions in Google Analytics ultimately comes down to executing the _trackTrans() method. What this means is that you can actually tell Google Analytics to record a “transaction” anywhere you want! Most people, of course, record transactions after a successful transaction actually occurs on their website. To take your e-commerce tracking to the next level, though, we’ll need to get beyond that. Instead of just seeing how much revenue you’ve earned in a day, what your top products are, etc., it’s vastly more helpful to know how much revenue you missed in a day. That’s your optimization opportunity! Which products were frequently added to your shopping cart, for example, but then not purchased? How much of the “revenue” that was added to your shopping cart actually ended up being real revenue in your pocket? These are the kinds of questions I’ll show you how to answer with a quick tweak to your Google Analytics setup.

What you’ll need to do is record transactions any time a user adds a product to his/her shopping cart. (If that sounds weird, don’t forget: as long as you execute Google’s e-commerce tracking code, you can record a transaction wherever you want!) However, you’ll need to record these add-to-cart transactions using a different Google Analytics property ID. So, if you’re doing your primary tracking with UA-XXXXX-Y, you’ll need to record your new add-to-cart transactions with UA-XXXXX-Z. Aside from that, however, your implementation of the e-commerce code for add-to-cart transactions will be essentially the same as your initial implementation of e-commerce tracking!

Here’s a quick example of the e-commerce tracking code you’ll execute when someone adds a product to your shopping cart:

_gaq.push(['_setAccount', 'UA-XXXXX-Z']); // Update UA-XXXXX-Y to UA-XXXXX-Z!
_gaq.push(['_addTrans',
'1234',           // order ID - required
‘Example Store',  // affiliation or store name
‘26.00',          // total - required
'1.00',           // tax
'5.00',              // shipping
'San Francisco',       // city
'California',     // state or province
'USA'             // country
]);
_gaq.push(['_addItem',
'1234',           // order ID - required
‘SKU123',           // SKU/code - required
‘ExampleProduct',        // product name
‘Category1',   // category or variation
'10.00',          // unit price - required
‘2'               // quantity - required
]);
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

As you can see, this is the same as a “normal” e-commerce implementation, but you’ve used _setAccount to flip your GA tracking ID from UA-XXXXX-Y to UA-XXXXX-Z. Of course, don’t forget to create a Google Analytics profile with the ID of UA-XXXXX-Z!

The end result is that you’ll have two Google Analytics profiles containing e-commerce data: one with “real” transactions, and one with add-to-cart transactions. Now you can dig into the juicy analysis. Either through the API or manually, you can start to compare things like SKU, Product Categories, or Product Names. For example:

  • Which products (or categories of products) have a high “completion rate?” In other words, which products are rarely abandoned after being added to the cart?
    • Could you feature these on the homepage, or make them part of an upsell?
  • Conversely, which products have a high “abandonment rate?”
    • Are these products available elsewhere for a lower price?
    • How much revenue are you losing on other products due to losing these transactions?

As you can see above, by combining the transaction metrics from your two profiles, you’ll now easily be able to see not just your revenue, but your revenue opportunity. For example, on the left, I can see that while my conversion performance for Gala Apples is fanastic, I’m really struggling with Russet Potatoes. On the right, I’m comparing entire product categories. Here, I can see that I’m doing great with the Vegetables category, but not nearly as well with Canned Goods.

I hope you’ll take advantage of this kind of analysis before the holiday rush is over! If you have questions, feel free to leave them in the comments, or tweet to us @CardinalPath.

Nick Iyengar

Nick is Vice President of Analytics at Cardinal Path, where he is responsible for the commercialization and delivery of Google Analytics and related services. When not working with clients, Nick authors original research, articles and blog posts, and speaks at conferences around the world. He is an alumnus of the 2023 college football national champion University of Michigan.

Share
Published by
Nick Iyengar

Recent Posts

Optimizing user experiences with Digital Experience Analytics (DXA) platforms

As consumers become increasingly digitally savvy, and more and more brand touchpoints take place online,…

1 month ago

Enabling Value-Based Bidding with Google Tightlock

Marketers are on a constant journey to optimize the efficiency of paid search advertising. In…

1 month ago

Resolving “Unassigned” Traffic in GA4

Unassigned traffic in Google Analytics 4 (GA4) can be frustrating for data analysts to deal…

2 months ago

This website uses cookies.