• Home
  • Google Analytics
    • Customizations
    • For Ecommerce
  • Speaking
  • About
    • About Me
    • Contact Me
    • Disclaimer and Privacy Policy

Analytics Talk

Digital Analytics for Business

You are here: Home / Ecommerce / Google Analytics E-Commerce Tracking Pt. 1: How It Works

Google Analytics E-Commerce Tracking Pt. 1: How It Works

Posted: January 13, 2008 56 Comments

This post is the first in a series of e-commerce transaction tracking with Google Analytics. Why is e-commerce tracking important? Well, transaction data is a vital piece of information when analyzing online business performance.

Sure, it’s great to measure things like conversion rate, but revenue is much more tangible to many business owners. Having the e-commerce data in your web analytics application makes it easier to perform analysis. Do you need to set up e-commerce tracking? No, but it sure helps. :)

The Big Pictures

E-commerce tracking is based on the same principal as standard pageview tracking. JavaScript code sends the data to a Google Analytic servers by requesting an invisible gif file. The big difference is that e-commerce data is sent rather than pageview data.

But how does Google Analytics get the e-commerce data? That’s the tricky part. You, the site owner, must create some type of code that inserts the transaction data into the GA JavaScript. Sounds tricky, huh? Well, its not that bad.

Step by Step: How it Works

Let’s break it down and walk through what actually happens.

1. The visitor submits their transaction to your server.

2. Your server receives the transaction data and processes the transaction. This may include a number of steps at the server level, such as sending a confirmation email, checking a credit card number, etc.

3. After processing the transaction the server prepares to send the receipt page back to the visitor. While preparing the receipt page your server must extract some the transaction data and insert it into the Google Analytics JavaScript. This is the code that you must create.

4. The receipt page is sent to the visitor’s browser.

5. While the receipt page renders in the visitor’s browser the e-commerce data is sent to Google Analytics via special GA JavaScript.

Here’s a basic diagram of the process. Again, the biggest challenge during implementation is adding code to your web server that inserts the transaction data, in the appropriate format, into the receipt page. I’ll cover the setup in part 2 of this series.

What Data can be Tracked?

Google Analytics collect two types of e-commerce data: transaction data and item data. Transaction data describes the overall transaction (transaction ID, total sale, 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. Here’s a complete list of the data:

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. First, the geo-location data is no longer used by Google Analytics. The new version of GA tries to identify where the buyer is located using an IP address lookup.

Also, you should avoid using any non-alpha numeric characters in the data. Especially in the numeric fields. Do not add a currency identifier (i.e. dollar sign) in the total, tax or shipping fields. this can cause problems with the data.

Like this post? Check out the rest of the series:

Google Analytics E-Commerce Tracking Pt. 2: Installation & Setup
Google Analytics E-Commerce Tracking Pt. 3: Why EVERYONE Should Use It
Google Analytics E-Commerce Tracking Pt. 4: Tacking Lead Gen Forms

Filed Under: Ecommerce, Tracking Tagged With: e-commerce, google-analytics, setup, Tips

Comments

  1. Craig Broadman says

    January 16, 2008 at 8:35 am

    When will part 2 be published, I am very intreaged as I have tried to get google-analytics ecommerce working for my asp.net website using a custom control and it doesn’t seem to work at the moment

    Craig

    Reply
  2. Aaron says

    January 18, 2008 at 12:56 pm

    I very much appreciate your blog but there is a burning question I have seen no answer to:
    – we would like to track who is clicking on our email tag-lines that have our corporate website URL in them.
    – I have tried making the link http://www.domain.com/emaillink/ and then I have a virtual directory in IIS redirect http://www.domain.com/emaillink/ to http://www.domain.com
    – The problem is that I cannot figure out how to make GA show me how many hits to http://www.domain.com came from http://www.domain.com/emaillink/
    – Is there a simple process I am missing?

    Thanks for the help

    Reply
  3. Justin Cutroni says

    January 20, 2008 at 8:43 am

    Craig,

    I’m working on it. :) Hopefully tomorrow.

    Justin

    Reply
  4. Justin Cutroni says

    January 21, 2008 at 9:26 pm

    Hi Aaron,

    You’re looking for information on Link tagging. Check out this post I wrote about link tagging.

    http://www.epikone.com/blog/2006/11/10/google-analytics-campaign-tracking-pt-1-link-tagging/

    You may also want to check out this post re: offline campaign tracking. It uses the exact virtual URL technique you describe.

    http://www.epikone.com/blog/2006/06/12/tracking-offline-advertising-with-google-analytics/

    Thanks for reading and thanks for the question.

    Justin

    Reply
  5. Sora says

    January 25, 2008 at 3:31 pm

    Oh, part 2 greatly anticipated ;D We also use asp and are having some trouble

    Reply
  6. Brent Crouch says

    March 2, 2008 at 9:26 pm

    Hi Guys,

    I’ve been trying to integrate GA E-commerce tracking with Paypal for a few weeks now. There doesn’t seem to be a lot of info out there on the subject.

    After a few weeks and a few hundred dollars, I’ve come up with a script that fully integrates Paypal with GA E-commerce. I’ve wrote a free ebook that includes the script you’ll need at no cost.

    There is nothing for sell here. I just wanted to see this info more widely available.

    You can get the ebook from this link.

    http://www.brentcrouch.com/2008/03/02/google-analytics-e-commerce-tracking-using-paypal-pdt/

    Good Luck,

    Brent Crouch

    Reply
  7. Ilja says

    May 20, 2008 at 2:47 am

    Hi,

    E-commerce tracking is fine. BUT in my opinion i think google already knows to much about us and companies. The know our adwords spendings, our traffic and giving them our total e-commerce income to them is a point that goes to far. The Analytics figures are in fact not even correct so it will never give the correct status.

    Companies that run millions in e-commerce will not give google those benchmarking benefits for their own commercial purposes if you ask me. Like our company. We use besides Analytics Urchin for servers. That is not free of course but has the same benefits.

    Small companies can easy work with Analytics and E-commerce tracking if you ask me.

    Reply
  8. Norbert says

    May 21, 2008 at 11:15 am

    I think I am going to become a frequent visitor here. Thanks for all the usefull tips.

    Reply
  9. Elizabeth Carey says

    September 8, 2008 at 12:31 pm

    i understand the code and what its doing and where to put it but my question is..the application I’m using is Flex and i don’t have a URL to a receipt page or a thank you page. So if someone can shead some light on this for me that would be great.

    TIA

    Reply
  10. Justin Cutroni says

    September 8, 2008 at 3:56 pm

    Hi Elizabeth,

    You need to somehow embed the code in your Flex. Talk to your Flex developer and ask them to add the code to the “receipt page” inside of the Flex code.

    Hope that helps,

    Justin

    Reply
  11. btard says

    September 15, 2008 at 1:32 pm

    “Insert transaction data into GA JS” – so we basically add this to the JS itself or pass it to a JS?

    – I am wondering how we do it for an initial spend? AND,
    – I am wondering how to do it for subsequent spending?

    Justin – great article, it would be great to work on some case studies or hypothetical examples to help certain business types achieve their goals. I could certainly create one for my business model and help the community who use GA.

    Cheers!

    Reply
  12. Justin Cutroni says

    September 15, 2008 at 8:57 pm

    Hi btard,

    Thanks for the comment. To answer your specific questions:

    – I am wondering how we do it for an initial spend? AND,

    Your server level code needs to take the transaction data and format such that Google Analytics can process it. GA can only record the data if you format in the special GA format, which I list above.

    – I am wondering how to do it for subsequent spending?

    You need to change your server code so that it will automatically format the data every time a transaction is submitted. This is the most difficult part of ecommerce tracking. Writing the server code takes time and can be pretty involved based on how elaborate your ecommerce platform is.

    Hope that helps and thanks again for the question.

    Justin

    Reply
  13. Chris Shepherd says

    November 10, 2008 at 10:50 am

    Great post as usual, the e-commerce tracking is a useful asset. I’m wondering whether it’s suitable for my scenario. I have pages which are worth more than others, but this depends on the advertising campaigns that are running at the time.

    Currently we’re trying goals but quickly realised that 1 visitor can’t trigger multiple goals, so this won’t give us an accurate figure if someone browses, 4 “premium” pages, we’ll only get 1 goal.

    Using e-commerce tracking, we could get the ad publishing system to write a value out to the GA tag, which will indicate the value of that ad impression, however this wouldn’t have a transaction ID which i believe to be required…

    do you have any suggestions in this scenario?

    Reply
  14. Justin Cutroni says

    November 10, 2008 at 12:00 pm

    Hey Chris,

    It does sound like ecommerce tracking will be more appropriate for you. As for the transaction ID, you can create your own value using something unique, perhaps a random number in combination with a time stamp. The big question is, do you want to ‘group’ multiple transactions together for a single user? If so, you can use the same transaction ID for all transactions that a user submits.

    Hope that puts you on the right track.

    Justin

    Reply
  15. Dave says

    December 12, 2008 at 8:32 am

    if anyone is looking for Google ecommerce tracking code integrate into new UK2 e-commerce package or Tradingeye software then you can take at look at this post:

    http://www.sailboatvn.com/web-development/google-e-commerce-tracking-modification/

    Cheers!

    Reply
  16. Yellow SEO says

    December 17, 2008 at 12:01 pm

    Thanks Justin great post,

    Great pointers, now I have to set up better method for e-commerce tracking. I didn’t know that the new version of GA tries to identify where the buyer is located using an IP address lookup.

    Reply
  17. Jonathan says

    July 25, 2012 at 7:59 pm

    Thanks for this post. I set up ecommerce tracking a while back but am looking to refresh myself on it. Read quite a few articles but this is very good. Will be checking out the other parts soon. Thanks :)

    Reply

Trackbacks

  1. Web Analytics Bloglinks der Woche (KW 3 / 2008) | Webanalyse & SEO - News says:
    January 20, 2008 at 11:27 am

    […] Google Analytics E-Commerce Tracking Pt. 1: How It Works (Analytics Talk) […]

    Reply
  2. TechWeb Media | Google rank spammer who steal blog content above authors! says:
    February 3, 2008 at 4:29 am

    […]   Analytics Talk » Blog Archive » Google Analytics E-Commerce … […]

    Reply
  3. Google Analytics E-Commerce Tracking Pt. 1: How It Works says:
    February 13, 2008 at 12:08 pm

    […] Head to AnalyticsTalk to read the full post! […]

    Reply
  4. Analytics Talk - This is a second post on the blog says:
    March 5, 2008 at 11:00 am

    […] This is part 2 in my series on Google Analytics e-commerce tracking. In part 1 I described, at a conceptual level, how GA e-commerce tracking works. In this post I’ll get into the specifics of the code and how to install it. […]

    Reply
  5. Social Metrics » Blog Archive » » Ultimate Google Analytics Resources says:
    March 19, 2008 at 2:03 am

    […] Google Analytics has quickly become one of the most popular analytics software available, additionally there are numerous resources available which deal with configuration, implementation, analysis, and reporting. Below I have compiled some of the most useful resources for Google Analytics related strategies.EpikOne: Improving the quality of your report’s data EpikOne: Google Analytics E-Commerce Tracking Pt. 1: How It WorksEpikOne: Google Analytics E-Commerce Tracking Pt. 2: Installation & SetupROI Revolution: Google Analytics ROI Calculation MacroROI Revolution: Should You Join the Migration? urchin.js Migrates to ga.jsROI Revolution: Tracking Secondary Sources and Autoresponders Using Site SearchGoogle Analytics Blog: Where Did My Paid Search Traffic Go?Google Analytics Blog: Site Search Now AvailableYouTube – Alex Ortiz: Advanced Techniques in Google Analytics YouTube – Avinash Kaushik: Google Analytics -Context and actionability in web analytics YouTube – Nick Mahailovski: Tracking Offline to Online Campaigns YouTube – Google Analytics Interface Tutorial […]

    Reply
  6. 20 Resources For Google Analytics | sidkaplan.com says:
    March 20, 2008 at 12:39 am

    […] EpikOne: Google Analytics E-Commerce Tracking Pt. 1: How It Works […]

    Reply
  7. 20 Resources For Google Analytics | Search Engine Studies says:
    March 20, 2008 at 12:46 am

    […] EpikOne: Google Analytics E-Commerce Tracking Pt. 1: How It Works […]

    Reply
  8. 20 Resources For Google Analytics says:
    March 20, 2008 at 1:49 am

    […] EpikOne: Google Analytics E-Commerce Tracking Pt. 1: How It Works […]

    Reply
  9. Recursos para Google Analytics | davidnovillo.es (o no es) says:
    March 25, 2008 at 3:40 pm

    […] EpikOne: Google Analytics E-Commerce Tracking Pt. 1: How It Works […]

    Reply
  10. E-commerce med Google Analytics | Think KPI says:
    July 31, 2008 at 3:49 pm

    […] Sitet Analytics Talk har skrevet 4 gode artikler omkring opsætningen og kreativ brug af E-commerce i Google Analytics. addthis_url = ‘http%3A%2F%2Fwww.think-kpi.com%2Fgoogle-analytics%2Fe-commerce-med-google-analytics%2F’; addthis_title = ‘E-commerce+med+Google+Analytics’; addthis_pub = ‘tabasco’; […]

    Reply
  11. Analytics Talk » Blog Archive » Google Analytics E-Commerce Tracking Pt. 3: Why EVERYONE Should Use It says:
    September 2, 2008 at 8:32 am

    […] Google Analytics E-Commerce Tracking Pt. 1: How It Works Google Analytics E-Commerce Tracking Pt. 2: Installation & Setup Google Analytics E-Commerce Tracking Pt. 4: Tracking Lead Gen Forms Share: These icons link to social bookmarking sites where readers can share and discover new web pages. […]

    Reply
  12. Google e-commerce tracking modification | Dave Sniper says:
    November 16, 2008 at 6:58 am

    […] 2. Analytics Talk […]

    Reply
  13. Google Analytics: Tutorials, Tools und Tipps | Dr. Web Magazin says:
    November 18, 2008 at 2:22 am

    […] Google Analytics E-Commerce Tracking […]

    Reply
  14. A primer for Google Analytics | Marc Baumann says:
    November 20, 2008 at 5:51 pm

    […] In case you have an online business, I recommend to read the post “Google Analytics E-Commerce Tracking: Installation and Setup” by Analytics […]

    Reply
  15. A primer for Google Analytics | Max The Web says:
    November 21, 2008 at 7:50 pm

    […] In case you have an online business, I recommend to read the post “Google Analytics E-Commerce Tracking: Installation and Setup” by Analytics […]

    Reply
  16. The Missing Google Analytics Manual | FutureNow's GrokDotCom / Marketing Optimization Blog says:
    February 16, 2009 at 9:48 am

    […] How Google Analytics Ecommerce Tracking Works […]

    Reply
  17. How to Use Ecommerce Tracking in Google Analytics says:
    May 7, 2009 at 8:15 pm

    […] reading parts 2-4 of this series on EpikOne’s Blog, Analytics […]

    Reply
  18. Bookmarks for May 13th « Paul Garcia says:
    May 14, 2009 at 9:21 am

    […] Analytics Talk » Blog Archive » Google Analytics E-Commerce Tracking Pt. 1: How It Works – […]

    Reply
  19. eCommerce Share » How to Use Ecommerce Tracking in Google Analytics says:
    May 21, 2009 at 10:20 pm

    […] reading parts 2-4 of this series on EpikOne’s Blog, Analytics […]

    Reply
  20. How to Use Ecommerce Tracking in Google Analytics | rapid-DEV.net says:
    June 15, 2009 at 12:24 am

    […] reading parts 2-4 of this series on EpikOne’s Blog, Analytics […]

    Reply
  21. How to Use Ecommerce Tracking in Google Analytics | work4real says:
    June 16, 2009 at 6:52 am

    […] reading parts 2-4 of this series on EpikOne’s Blog, Analytics […]

    Reply
  22. A Guide to Google Analytics and Useful Tools « Tech7.Net says:
    July 16, 2009 at 11:28 am

    […] Google Analytics E-Commerce TrackingThis series of article has 4 parts: 1 | 2 | 3 | 4 […]

    Reply
  23. Everything You Ever Wanted to Know About Google Analytics - Birdsall Social Media says:
    July 23, 2009 at 11:14 pm

    […] Google Analytics E-Commerce Tracking This series of article has 4 parts: 1 | 2 | 3 | 4 […]

    Reply
  24. google分析的电子商务功能 - 大漠孤狼网迹 says:
    July 28, 2009 at 3:37 am

    […] … JSApiEcommerce.html http://www.epikone.com/blog/2008 … -pt-1-how-it-works/ […]

    Reply
  25. 27 Excellent Google Analytics Articles | Pajama Professional says:
    August 31, 2009 at 9:07 am

    […] Google Analytics E-Commerce Tracking […]

    Reply
  26. A Guide to Google Analytics and Useful Tools « Smashing Magazine says:
    October 10, 2009 at 8:53 am

    […] Google Analytics E-Commerce Tracking This series of article has 4 parts: 1 | 2 | 3 | 4 […]

    Reply
  27. A Guide to Google Analytics and Useful Tools « Vibbit Social Networking and Website Design for Under 89.00 says:
    November 17, 2009 at 11:16 pm

    […] Google Analytics E-Commerce Tracking This series of article has 4 parts: 1 | 2 | 3 | 4 […]

    Reply
  28.   A Guide to Google Analytics and Useful Tools by Oshoamy says:
    December 5, 2009 at 4:51 am

    […] Google Analytics E-Commerce Tracking This series of article has 4 parts: 1 | 2 | 3 | 4 […]

    Reply
  29. 8 Great Tips For Ecommerce Success | Graphic SEO Free SEO Tutorials says:
    January 8, 2010 at 2:56 am

    […] but they have not enabled e commerce tracking. If you dont know how to set up e commerce tracking here is a great tutorial on it5) Dominate On Keywords That Convert – A good rule of thumb for any ecommerce site is to open […]

    Reply
  30. 10 Sources For Better Conversion says:
    August 8, 2010 at 3:31 am

    […] Google Analytics ecommerce tracking (part 1). […]

    Reply
  31. Useful Analytics Tips and Resources for Designers and Marketers | Vandelay Design Blog says:
    February 28, 2011 at 6:57 am

    […] Part One – How it Works Part Two – Installation and Setup Part Three –  Why Everyone Should Use It Part Four –  Tracking Lead Gen Forms […]

    Reply
  32. Useful Analytics Tips and Resources for Designers and Marketers | Web Design Blog #1 says:
    February 28, 2011 at 8:13 am

    […] Part One – How it Works Part Two – Installation and Setup Part Three –  Why Everyone Should Use It Part Four –  Tracking Lead Gen Forms […]

    Reply
  33. Google Analytics E-Commerce Tracking Pt. 4: Tracking Lead Gen Forms - Analytics Talk says:
    December 6, 2012 at 7:58 pm

    […] Google Analytics E-Commerce Tracking Pt. 1: How It Works Google Analytics E-Commerce Tracking Pt. 2: Installation & Setup Google Analytics E-Commerce Tracking Pt. 3: Why EVERYONE Should Use It […]

    Reply
  34. Tracking Restaurant Orders in Google Analytics | Jackson Lo says:
    January 30, 2013 at 10:04 am

    […] I recently began testing a more unique usage of Ecommerce Tracking in Google Analytics for restaurant websites. And so far, it’s been a fairly smooth sail. If you’re just starting with Ecommerce Tracking in Google Analytics, I recommend reading Justin’s 4 part series on this subject on his blog. […]

    Reply
  35. Google Analytics E-Commerce Tracking Pt. 2: Installation & Setup - Analytics Talk says:
    February 19, 2013 at 10:53 am

    […] is part 2 in my series on Google Analytics e-commerce tracking. In part 1 I described, at a conceptual level, how GA e-commerce tracking works. In this post I’ll get […]

    Reply
  36. Tracking Ecommerce Transaction with Universal Analytics says:
    March 22, 2013 at 12:08 pm

    […] general, Universal Analytics ecommerce tracking functions the same way as the standard Google Analytics ecommerce tracking. Google Analaytics collects the transaction data using a special JavaScript tag that you need to […]

    Reply
  37. From Rags To Riches – The Pauper's Guide to Optimizing Your Site's Performance | Tom Bowen's Blog - Web Site OptimizersTom Bowen's Blog – Web Site Optimizers says:
    April 29, 2013 at 12:25 pm

    […] definitive guide for setting up Google Analytics for ecommerce sites  is a four-part blog post by GA expert Justin Cutroni.  As I said, you might have to get with your developer to implement the code changes, but many […]

    Reply
  38. How to Pass the Google Analytics IQ Test in Two Days: Zero to Hero - Articles in IT and more | Articles in IT and more says:
    July 1, 2013 at 2:42 pm

    […] e-commerce site, it's certainly worth tracking user transactions. Justin Cutroni published a series of helpful posts on the topic, and Google's official documentation will certainly come in […]

    Reply
  39. How to Pass the Google Analytics IQ Test in Two Days: Zero to Hero | WordPress Coders - Articles says:
    July 1, 2013 at 3:09 pm

    […] e-commerce site, it's certainly worth tracking user transactions. Justin Cutroni published a series of helpful posts on the topic, and Google's official documentation will certainly come in […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

My Books

Google Analytics by Justin Cutroni
Learn More on Amazon.com

Performance Marketing co-authored by Justin Cutroni
Learn More on Amazon.com

Recent Posts

  • Understanding the Google Analytics Cohort Report
  • Using Offline and Online data to drive Google Analytics Remarketing
  • Understanding Cross Device Measurement and the User-ID
  • Universal Analytics: Now out of beta!
  • Advanced Content Tracking with Universal Analytics

Categories

  • About Google Analytics (25)
  • Analysis (52)
  • Analytics Strategy (3)
  • Campaign Tracking (14)
  • Ecommerce (8)
  • Event Tracking (10)
  • Remarketing (2)
  • Reporting (10)
  • Resources (7)
  • Tag Management (5)
  • Tips (25)
  • Tracking (52)
  • Uncategorized (64)
  • Universal Analytics (9)
  • Web Analytics (15)

Copyright © 2023 ·News Pro Theme · Genesis Framework by StudioPress · WordPress