The ROI Revolution Blog
« Advanced Bid Management Tactics | Main | Power Using the New AdWords Interface, Part 1: Integrated Search Query Reports »
Stressing About Your Google Analytics Ecommerce Variables?
May 7, 2009
Whether or not you have the pressure of reporting revenue information to others, if you're running an ecommerce site you should be tracking your ecommerce with Google Analytics. What the helpful articles on setting up ecommerce don't tell you, is that if you use 3rd party shopping carts or CMS' - setting up ecommerce can be quite a challenging task. Google Analytics provides you with the ecommerce template that is used to pass data to the reports. What it doesn't give you is a breakdown of the necessary pieces - what's required and what isn't? Before we jump into that, lets first take a look at the Google Analytics ecommerce code:
pageTracker._addTrans("order-id", "affiliate", "total", "tax", "shipping", "city", "state", "country");
pageTracker._addItem("order-id", "SKU", "product name", "category", "price", "quantity");
That's a lot of information! 13 separate pieces of information you need about your customer and their transaction! If you use an internal or in-house shopping cart, getting the actual transaction variables to pass in should be fairly easy. But instead let's say you're using a 3rd party shopping cart that doesn't offer an easy plug-in. What variables do you need to pass to this ecommerce code on the thank you page to get the data you need into Google Analytics? Let's break down the two methods of the Google Analytics ecommerce script: the addTrans method and the addItem method.
The addTrans method really only contains two required variables, the order-id and the total. The order-id is what distinguishes this transaction as its own unique transaction within Google Analytics. If your shopping cart doesn't give you an order-id (or transaction-id) you could always use a time stamp to differentiate your transactions.The total purchase amount is also a required field in order to see the total amount of revenue within Google Analytics.
All other variables within the addTrans method are optional.
- The affiliate field is not required, and was removed from the Google Analytics Ecommerce reports. You can still use the affiliate field for custom reports and filtering.
- Tax and shipping appear in the transactions report if you have access to those variables.
- The city, state, and country are currently not being used by Google Analytics, but the information is still being collected. You can however use these fields within the profile filters if you have a use for them.
Now, lets take another look at the ecommerce code with the required variables:
pageTracker._addTrans("order-id", "", "total", "", "", "", "", "");
pageTracker._addItem("order-id", "", "", "", "price", "quantity");
This looks much less intimidating. Most shopping carts should have this post data available for you, so with a little programming magic you should be able to get ecommerce up and running!
If you are stressing out about getting variables to track your ecommerce transactions don't sweat it. All you need is the order-id, total transaction amount, item price, and quantity and you're on your way to having useful ecommerce statistics within Google Analytics.
Interested in learning more about Google Analytics?
Attend our LIVE Google Analytics Seminars for Success training in Atlanta, GA Wednesday, April 14th, 2010 and Thursday, April 15th, 2010 or get the latest tips and tricks sent to you via our free, twice-monthly Google Analytics newsletter.
Posted by Caitlin Cook, Analytics and Optimization Specialist at 3:03 PM
Permalink | Comments ( 14 ) | TrackBacks ( 0 )
Filed under: Analytics
Tagged as: Analytics Technology
Comments
@ Jodi: I'm so glad you found this information useful! Thank you for reading, and good luck getting everything set up!
May 28, 2009 6:04 PM
Caitlin, do you know any resource where I can get info on how to set up my 3rd party shopping cart to feed those variables back through the javascript to Analytics?
May 28, 2009 7:16 PM
Hi Caitlin,
Thanks for the great post. I am curious though about how the tax part of the _addTrans() method is dealt with in the reporting. Does the total include the tax? I assume also that the total doesn't include the shipping?
Thanks.
June 2, 2009 6:07 AM
@Jodi: It really depends on your shopping cart. Some 3rd party shopping carts will provide a list of the available variables while others will take some trial and error plus some digging through code. And since all shopping carts are different, there isn't one good resource for getting those variables. Check with your shopping cart provider first to see if you can get that variable information before going crazy trying to find it elsewhere.
June 4, 2009 12:09 PM
@ Jarrod: Within the Google Analytics ecommerce reports the revenue should include the tax and shipping amounts. To help troubleshoot you could always look at a specific transaction revenue and compare that to the item price or look at the item in your back end system to make sure but from what I've seen it will automatically add the tax and shipping to give a complete total revenue.
June 4, 2009 12:29 PM
nooB question...
For order-id, price, and quantity, if my cart calls these varaibles ID, total and ammount, how do I alter the code to pass the variables, if my variables are named differently?
September 25, 2009 10:29 AM
@ Digiboy: You will need to use a scripting language to pass the variables in to the Google Analytics ecommerce code. The order-id, price, and quantity are all place holders for where that information should go. So in your case using ID in place of order-id, total in place of price, and amount in place of quantity will work just fine as long as the actual values being passed into Google Analytics are representative of those placeholders.
September 28, 2009 4:41 PM
Hi! Great post. We've been having an issue for quite some time - namely, we cannot get the medium/source data to pass through to our ecommerce section of GA. The product sales data does, but not the source, and in turn we get either a)direct sales or b)sitbetter/referral sales. I've been looking for a solution but it seems no one has this issue but us! Any thoughts?
October 9, 2009 1:03 PM
@ Alec: Typically referral problems occur when there are multiple domains, multiple subdomains, or redirects involved. You may want to check into those to see if that helps to solve any problems!
October 9, 2009 2:03 PM
Hi, thanks for post. I am looking for a method which i can send more details (columns) on pageTracker._addItem. Do you think it is possible? If so how? Thank you very much.
December 29, 2009 10:17 AM
@ Aydoghdu: The _addItem function already has a set number of variables that it can accept so as far as I know there isn't a way to add additional data fields. You can however use the data you need in place of the fields that already exist - like the affiliation field in the addTrans function.
January 4, 2010 3:22 PM
thank you for this post - it's helped greatly.
I do have a question if you have any input. I have my information set up for GA to track my ecommerce transactions (I use 1shoppingcart). I cannot find the variables on the shopping cart side that I need to plug into my code. I have tried contacting support at 1shoppingcart, and they have NO input for me.
How do I go about digging to find the actual variable names I need to make this work?! It's super-frustrating! Thank you!
January 29, 2010 12:19 PM
@ Tammy:
Google Analytics integration with 1ShoppingCart can be difficult, so I'd keep hounding 1ShoppingCart support for the variable names if I were you. If you've exhausted all other options you can look into getting a support plan with us. We've previously had success with 1ShoppingCart and Google Analytics ecommerce installations. Good luck!
Receive new blog posts immediately direct to your email inbox!











You are awesome! Best info on this that I could find!!
Sad to say, I still don't have it working yet -- but brought us one step closer, and I appreciate that.
May 28, 2009 4:52 PM