top of page
  • Jill Quick

How Does Ecommerce Tracking Work?

Got a website that sells stuff? Want to track all that ecommerce data inside Google Analytics? Bring your reading eyes this way...


How does Ecommerce Tracking work in Google Analytics?

If you have a website where you are selling stuff. As in, I would have the ability to go to your website, add to cart, give you my credit card details and pay you for the order. Then you need to set up ECommerce Tracking.

You may think that this has something to do with Goals, and it kinda does. It’s quite conversion orientated, to show that your website traffic equals dollar-dollar bills. If you have a thank you page for your orders (as in a page you get to which only happens if you complete the sale (e.g. /thanks-for-shopping) which is highly probable, then you will, of course, want to create a goal to show that people converted. Which is obviously very useful in itself.

But, if you sell lots of things, like a clothes shop, or software as a service with bespoke product options, you’ll need more than just a ding-ding of the bell to say you made a sale. You need and dare I say it, you should want to know more.

We have a super resource for you to download (for free) which is a handy explainer that summarises this blog post. Head over here for the ecommerce tracking goodies.

You want to record and report on the transaction total (so how much cash did you make on that sale). You want to know which products you sold. If there was any tax added to the sale. You would want to know the name of the product. So, yeah. More than you get from just the thank-you-page-we-have-your-money destination goal.

Hopefully, you’re sold on the idea that you should be getting this extra information inside your analytics.

Spoiler.

You are going to need to work with your developers to make the magic happen. Which is going to require some work.

First things first, let’s understand the concepts and the process to make it happen. There are two types of E-Commerce tracking that you can use.

Basic Ecommerce Tracking

Basic Tracking works by adding additional code to your thank-you pages that confirm a sale. There will be code on that page that will push data into your Google Analytics Account. There are two types of data types that are used, which are:


‘Transaction Data’, which is as it sounds, the revenue, shipping, tax data. And ‘Item Data’, which is data about the items you are selling, be it services or products. So, think about the name and price of the items you are selling, the SKU code (that means stock keeping unit, which is used in managing inventory). Then you have things like the item category for example Dresses, Shoes, the quantity (how many you sold) and the transaction ID. All useful information, as a start, we think.

Enhanced Ecommerce Tracking

Enhanced ECommerce needs a bit more work from you so that you get the lovely data into your Google Analytics Account. As a side note, depending on what you sell and how much money you make, you may decide to start out with Basic ECommerce. As you build and expand your business, move up a level to Enhanced ECommerce. It all depends on your business model, marketing strategy and budget.

Ok, so back to Enhanced ECommerce. Unlike Basic tracking, which happens on the thank-you page, for a completed order – here, there’s additional code that needs to go on other pages of your website, like the product pages and checkout steps.

Enhanced ECommerce gives you more than you get from Basic, unsurprisingly, and it has five data types which as you will see can overlap between each other.

‘Impression Data’ gives you insights regarding how the product was Viewed on your website. Things like the brand that is associated with the product, variants of the product, for example, black dress, white dress, the position the product was in if it was in a list or collection.

‘Product Data’ gives information on individual products. So, things like the brand name associated with the product, and if say a coupon code was used for the product purchase.

‘Promotion Data’ passes information about any promotions you have that were viewed by customers. Things like the creative, did they see a promotional banner and click to the product page.

‘Action Data’ is the bottom line stuff, all the ECommerce action data = money data stuff. This is where you can send the revenue data to Google Analytics if any tax was associated with the transaction or shipping costs. It also has the ability to track the specific steps in the checkout process, which is very handy when you want to see if you have a leaky bucket. Do people get to the last page and just leave? This would give you at least, a starting point to investigate what’s going on with your checkout flow and ideas on how to fix it, so you make more money.

‘Product and Promotion Actions’ helps you to interpret product and promotional data that you send to GA. Like people adding products to shopping carts, or removing them, if they initiate the checkout process, that kind of thing.

All sounds wonderful doesn’t?

Now, how do you get the goods into Google Analytics?

Setting up E-Commerce for Google Analytics

Short answer – ask your developers. This also happens to be the lazy, kind of useless answer.

The real answer, working with your developers. You need to map out a clear plan, which will vary depending on how your website is built. We’re after all our own individual and special snowflakes, so the implementation can vary from one ECommerce setup to the next. It really should, if we are honest.

The first thing to check in your Google Analytics Admin audit is to check your Conversions> ECommerce reports. Is there anything there?

If you don’t find anything in the reports but you think you had the ECommerce data added to your website by a developer, the next check is to go to your View settings and for each View you have, check if the ECommerce toggle is turned on. Is it?

This may seem really bloody obvious, but I have done many audits that HAD the data on the website, but nobody knew to go to View>Settings and turn this toggle ‘Enable E-Commerce’ to ‘On’. So they both had their data and did not have the data. Fun times. And as you know all too well now dear readers, Google Analytics will not go back in time and re-process your data. I had a client that missed out on two whole years of data because someone didn’t turn this toggle on. And, I’ve seen an Account where one View had Basic turned on, and the other reporting View had both Basic and Enhanced ECommerce turned on. It happens.

For some of you, you either have it set up (thank the analytics gods) and you just need to check if you have or need the Enhanced option.

Some of you, just need to turn on the toggle to receive this information in your Account. For the rest of you.

You need to get this specced up, and briefed in, with your technical dev-people. There are a few ways to do this. How it’s done for you will depend on your ecommerce platform, your shopping system as it were.

If you are using something like Shopify, or WooCommerce, they have plug-ins to help setup ECommerce within Google Analytics. So, go check out what types of integrations you have with your shopping system provider and how they might work with Google Analytics. After that, you can either manually do it, as in manually tag your site. Admittedly, almost no one really does now because it ain’t 2005 anymore. Instead the common, the go-to option, is to use Google Tag Manager (hello again GTM).

Google Tag Manager will help you populate the data layer with ECommerce transaction and product variables (those data types we just chatted about) that one would have on their thanks-we-have-your-order page.

Or, if you are going into the Enhanced ECommerce route, populate the data layer with data for the product and checkout pages on your website.

A few things may be going through your head right now, as they went through mine when I first learned about ECommerce tracking.

One thought was, why can’t I just pop the code from the Google developer help pages onto each page, like adding the Google Analytics tracking code? Well, each sale is unique to the user, so the data is dynamic, as in, it is unique to the user. Plus, your business is unique too, so you need to tell our lovely GA computer program which data types it should be looking for, for example, what your brand names are for a product, because, how would it know?

What is a data layer?

The next thought, for me anyway, was “what is a data layer?”

Good question.

So, let’s just chat about the Data Layer.

If you Google ‘Data Layer’ you get an answer like this “A data layer is a JavaScript object that is used to pass information from your website to your Tag Manager container.” So, think of the data layer like an intermediary. You pop your data into the data layer, and it keeps it nice and safe, to then pass on to your website, which has other things linking to it, like your Google Analytics javascript.

Provided you have sent your data to the intermediary, and that data is written in the language of the platform it’s passing the information onto, it works. Oh, and don’t forget about turning the toggle ON to receive the ECommerce data.

Your Ecommerce Tracking Plan

So your plan is, as mentioned, to check if you have ECommerce data in your Conversion reports first.

Then head to your View settings, and make sure you have turned on the toggle to receive the data. If you have more than one View, check each View to make sure.

  1. Sign in to Google Analytics

  2. Click Admin, and navigate to the View you want

  3. In the View column, click E-Commerce Settings

  4. Set Enable ECommerce to ON

  5. Click Next step

  6. Click Submit

Check your Ecommerce platform to see if there are any plug-ins that will help with the heavy lifting.

If your shopping system has no plugin, or you have a bespoke shopping system on your website, you need to brief your development team.

You will need to get the ECommerce Plugin setup on your site, which is referenced in the Google Analytics Developer Guide. This is not the same as say a Shopify plug-in. This is a Google thing, and in their words:

To reduce the size of the analytics.js library, ECommerce tracking is not provided in the default library. Instead, it is provided as a plugin module that must be loaded before being used.

To load the E-Commerce plugin, use the following command: ga(‘require’, ‘E-Commerce’);

This command must occur after you create your tracker object and before you use any of the E-Commerce specific functionality.

Once loaded, a couple of new commands specific to E-Commerce tracking will be added to the default tracker.”

There are two types of ECommerce Plug-ins for you to use, one for Basic ECommerce tracking and another for Enhanced Tracking. If you are bumping yourself up from Basic ECommerce to Enhanced you need to get your dev team to migrate your plugin from the Basic plugin to the Enhanced plugin, as they can’t work together.

Basic ECommerce Tracking

For Basic ECommerce to work on your site, you need to populate the data layer with the following data variables, and they need to be triggered on your “thank-you-confirmation” page. The data variables that are required in order for it to work are:

  • transactionID

  • transactionTotal

Optional data variables are:

  • transactionShipping

  • transactionTax

  • transactionProducts

Although it’s optional, most ECommerce sites would add the transactionProducts to the list, as it gives you richer information. Using transationProducts means you have to use these variables:

  • Name

  • SKU

  • Price

  • Quantity

There is an additional optional data type too:

  • Category

This one is used a little bit less often.

These transaction tags will then show up in your Conversions reports. See this example from an Account that is just using Basic ECommerce. We can drill into the product performance to see out of all the products we sell, which ones have been sold on the website in a given period of time. How many were sold, and our product revenue.

Sales Performance is a report that shows how much you made in a given day. And remember here guys, it is going to pull in data as per your time zone for that View.

The Transaction report will populate all the Transaction IDs which will link up to your shopping system. Time to purchase shows the number of days between a user purchase and the campaign referral.

This is very valuable information.

Enhanced ECommerce Tracking

If you want to level up from there, this is going to take a lot more work from your developers. All five data types we have mentioned work together to give you so much more information, and a totally different report in Conversions> E-Commerce.

Now, I am not going to go through all the data types in detail, as that would probably send you to sleep. You can have a look at them all here. What I will say, is that there are a set number of requirements that I would have as my go-to ECommerce enhancements.

  • Clicks on a product link

  • Viewing product details

  • Impressions and clicks of internal promotions

  • Adding / removing a product from a shopping cart

  • Initiating the checkout process for a product

  • Purchases and refunds

In addition, I would want to have my ECommerce funnel mapped out so I can drill down into the ECommerce data further, by looking at the Shopping and Checkout Behaviour reports. Now, just to note, this is turned on at View level, where you type in the name of the steps into your funnel set up.

These have to match the name you have given in your enhanced ECommerce settings. So please, please, sit down with your dev team and agree on user-friendly, idiot-proof names, as they are going to show up in your Account.

This example from the Google Demo Account is a good example of clean, user-friendly labeling.

  • Billing and Shipping

  • Payment

  • Review

Things to Keep in Mind

I have done a lot of GA audits and when it came to E-Commerce companies, they always asked why there was a data discrepancy.

The first thing I do is an audit of their Admin settings. Common culprits are things like having staging sites active, but not filtered out so you get the staging/test data. View settings with the wrong timezone, not having the correct Account structure can all make the data murky. If you have ECommerce set up correctly, there will always be some gaps.

Why? Well, Google Analytics was created to track what your website visitors are doing on your website. It was not designed as a customer relationship management database or a shopping accounts system. Let’s be fair.


Which means, it will tell you how many people bought a particular product, the transaction ID, all that glorious stuff. However, it will not tell you if someone who bought the clothes then decided to send them back to you in the post because they didn’t quite look right on them. Or if they buy the hotel room, and then cancel the order. All that refund data, yeah, that will not appear in the Account.

Although, there are some workarounds to fix this. It is possible to link up CRM and Sales systems to push data back into Google Analytics so you get a better picture with Custom Dimensions and Metrics.

Like what you read here? We have a whopper of a Google Analytics Course in which we cover your Admin Settings, so you can find out how to clean up your data ecosystem. And our Advanced Analytics module in our Google Analytics Course talks through the workarounds we just mentioned. You should check it out..

For students on our Google Analytics Course, you get access to all our editable templates. In particular, we have one for Ecommerce Tracking and Briefing.

This template has been created to bridge a conversation with what you, the marketer or the business owner wants to have in GA. This process to get ecommerce data into Google Analytics could be much smoother IF marketing and development work together. And that needs a good brief. With clear outcomes.

So use this template to get everyone on the same page, agree on timelines and what needs to happen in order for the ecommerce tracking magic to happen.

Go check out our Google Analytics Course details here! You know you want a peek.

bottom of page