One thing that I try to stress in my client work and training is that Google Analytics is a platform. If you understand the framework you can use it to track many different things. E-commerce tracking is one part of Google Analytics that is particularly flexible and can be used many different ways.
There’s a lot you can do with e-commerce tracking even if you’re a non-commerce site. You can use the e-commerce reporting to monetize lead gen forms and measure visitor interactions with a form.
The Need
Let’s say we have a lead gen site that sells books, cars and jets (a completely unlikely combination). The site has a very simple lead generation form that let’s the user choose the item they are interested in and their time frame for purchase.
We want to measure which fields visitors fill out, the values they choose, and the overall value of the form.
The Implementation
To measure the above I created a simple form using HTML and JavaScript. Here’s what the form looks like:
And here is the source of the above form:
When the visitor submits the form the JavaScript code assigns a value to both the item that the visitor chose and their time frame for purchase. It then calculates a total value for the form by summing both values.
In this example a form that includes a high priced item (like a jet) and a short time frame (buy now!) is worth more than a low priced item with an unknown time frame. I chose arbitrary values for each item and each time frame, but you could derive these values from business data.
After manipulating the data the code places both pieces of information in the GA e-commerce format where they are happily whisked away to Google.
I decided to do all of the calculations in JavaSript because it was easy. You could create a “form calculator” on the server side, but you would still need to format the data like a transaction in order to send it to Google Analytics.
The Data & Analysis
Remember, we’re using the e-commerce framework to equate products to form choices. So any report that displays product information will really show form elements and their values.
The best example of this is the E-Commerce > Product Performance > Product Overview report. This report simply lists all of the products that were purchased in all of the transactions.
Based on the way I created the code, each “product” in the report will be a combination of the item that he visitor is interested in and their time frame for purchase.
How is this data actionable? This information is the direct voice of the visitor. The visitor is literally telling us what they want and when they want it.
From the report above we can see that everyone wants a jet. Most visitors did not specify a time frame for purchase but one visitor wanted a jet today. I’d call that a hot lead!
Another report that is very useful is the E-commerce > Transactions report. In our configuration this report lists all of the forms that have been submitted and the value of each.
The great thing about this report is we can drill into each transaction and review the specific form details. If I click on the first transaction in the report above I get the details of the form (see image below).
I know this example is not that exciting, but image a form with many, many fields. You would be able to see all of the visitor’s choices and better understand what made a specific form valuable.
The effect of using e-commerce tracking for a lead gen form goes far beyond the e-commerce reports. Remember many reports in Google Analytics have an e-commerce tab that displays monetary metrics related to the data in a report.
For example, the Traffic Source > All Traffic Sources report will show metrics like average order value, transactions and revenue for each traffic source. If you use standard goal tracking you will only get conversion rate. I think this is far more valuable.
A Reminder
You’ve probably figured out that you can use e-commerce to collect many different types of data. Please be mindful of your site’s visitors and the Google Analytics privacy policy. It is not permitted to collect personally identifiable information using Google Analytics.
This is part 4 in a multi-part series on e-commerce tracking. You may be interested in parts 1, 2 and 3:
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
Hi Justin,
Just wanted to say thanks for this post! (And the last one too.)
Ever since the seminar in San Francisco I’ve been seeing almost every contact form as an opportunity to use e-commerce tracking to get more accurate information. This post answers the inevitable question: “Why should we do that?”
Hi Justin,
I really appreciate your blog, I’ve found lots of tips and tricks to apply to analytics for my affiliate business.
One question I have though is what if the “thank you” or lead confirmation page is remotely hosted. Many times the remotely hosted page also has it’s own GA tracking installed. I want to do all the split testing possible on my landing page but also relate it to conversions on this remotely hosted page while not screwing up their data.
Any suggestions.
Again, really appreciate this blog and hopefully going to attend one of your seminars in the future.
Thanks,
Tob
My analtic data suddenly stopped workin after months of recieving data. What’s going on? I did a scan and it came back fine. If you have time could you provide me some direction?
Hi Tob,
Glad you like the blog and find it useful. If your thank you page is hosted by a third party then you want to implement cross domain tracking. This feature will let you track the visitor from the originating source all the way through to conversion.
The cross domain tracking feature requires that you add your tracking code to the remotely hosted page. If you can not add your code to the remotely hosted page then you won’t be able to see conversion data in your GA account.
Hope that helps,
Justin
Hi Justin,
Great name ;)
I would check two things to determine why your analytics data has stopped collecting:
1. The tracking code: make sure the code is on every page that you want to track. If it is not then you will not get the data you expect.
2. Profile settings: make sure you have not added a filter or changed a setting that excludes all of your data from GA.
These are the most common culprits when GA data “flatlines”.
Thanks for reading,
Justin
Hi there,
With the javascript in your example, do you need any further code (apart from the standard tracking code) on the thankyou page?
Cheers, ToNy!
Hi Sheds,
The code I created is meant to be an example. The code that you will use on your site will differ for a number of reasons.
First, the form that you are tracking will probably be different than my form. That will cause the JS to be different.
Second, the ‘calculator’ you create will have different values because your form choices will have different values.
I suggest using the code above as a test. Install it on your server, observe the results and then start building one for your site.
Hope that helps and thanks for reading.
Justin
Hi,
I am a bit confused on installing the ecommerce tracking code.
Do I need to do additional coding/programming for it to work?
Are my first step is to identify what the fields are called and if they don’t match to what GA is looking for is that where I need to do some programming to convert the field names to GA’s identifable field name?
Thanks,
Beth
Hi Beth,
I’m assuming that you’re talking about adding ecommerce to track lead gen forms as this is the tracking lead gen forms post :)
If that is the case, then no, you really don’t need to add any server level code. You could add some code if you wanted to create some type of ‘value engine’ for a form submission, but that is not mandatory.
If you’re talking about using ecommerce tracking to track transactions then you DO need to add some server level code to format the transaction details in the GA format.
Thanks for the question and I hope that helps.
Justin
The problem I’m having with the ecommerce tracking code is that more transactions are getting counted than that actually happen. I’m thinking it’s because people are either bookmarking or refreshing the page, causing the code to run multiple times. Do you know of a way around this?
The data you can get from ecommerce tracking is awesome – but I need to be able to trust my numbers :o)
Great articles and blog! Thanks for all the great information.
Susan,
Great feedback. You might want to think about adding some type of check, be it at the server level or the browser level, to restrict additional transactions.
Thanks for the feedback.
Justin
Hi Justin,
Interesting article – I’m currently researching field tracking with G Analytics, but we’re trying to figure out how to find the “exit field” in a form – i.e. the last field a user has entered before abandonment. Also, we have a lot of “free type” style fields, that factor into this, plus drop downs like above. Have you ever dealt with this specifically and do you know how to accomplish getting readable data in GA for this? Any feedback would be greatly appreciated!
Best,
Dani
Dani,
We’ve doe something similar. It requires the creation of some JS to mintor what the visitor is doing. We usually create an event rather than a pageview that marks what people did, and did not, fill in.
Hope that helps,
Justin
Hi Justin,
This post was extremely helpful to me. I’ve learnt a lot from your blogs.
I’m trying to tweek the code so after the validation process, I can collect the amount of items and total spend and send it to GA. However, I’m not a JS expert and find that nothing is being sent.
I’m tried the following with little success;
1. Incorporate the event tracking inside the validation function.
2. Using two functions in the onSumbit button.
3. Outside for validation function with the onSubmit button calling the Ecom tracking.
4. I’ve tried to put an alert in there to see what information is being collected.
Can you offer any advice on where I should go from here?
Duong,
That’s a tough one. It really depends on the validation code. I would try using a tool like FireBug to look for errors in your JS.
Hope that helps and thanks for the question!
Justin
Hi Justin –
Great site and lots of excellent information.
Quick question: Is it possible to track two different types of lead gen pages using the e-commerce code? For example, let’s say people getting to Page A is worth X to us and people getting to Page B is worth Y to us. We’d want to be able to track them separately at different values.
Thanks!
Nick
Nick,
Yes, that is possible. What I would suggest is to track the different lead forms as different products. Then you can assign a different value to each form.
Hope that helps!
Justin
Hi Justin –
Yes, that helps. Thanks for the response.
One follow up to my question: When setting a value for each “product”, do I just set it in the _addItem() section in the “price” field? Or do I also need to enter the same value in the _addTrans() section in the “total” field? (I guess I don’t really know the difference between the two — i.e., where analytics applies the value to the transaction.)
Thanks again.
Nick
Hi Justin,
Great post, thanks so much! I can across this post because I have ecommerce tracking installed however it is only attributing the data to Direct and Referral traffic… And, the shopping process does not go to a different domain or subdomain. It stays on the same domain during the entire transaction.
Do you have any idea why I’m not seeing data from PPC or Organic traffic?
Thanks, your advise would be greatly appreciated!
-Heather
Heather,
There could be two problems. First, make sure your link tagging is correct and that there are no issues with redirect. Once you’ve verified that the link tagging is working you need to investigate what’s happening to your cookies. I would double and triple check that there are no other domains involved. What’s happening is that the tracking cookies have the wrong data. And that usually only happens when there are more than one domain used.
Hope that helps!
Nick,
The transaction total is the total for the entire transaction, while the item value is just the total value for a specific SKU.
Hope that clarifies things.
Justin
Hi Justin
Thanks for all the info in the 4-part series. I’m taking baby steps in GA and this is my Day 1, can’t say I fully understand what the thing is about and how to use it on my blog, but at least I know that there’s plenty to learn. I’ve written a laptop repair tutorial that I just started selling. I see that I have over 5500 visitors since November, but very few paying customers. I hope that your tips will be helpful to make more visitors into paying customers.
Keep up the good work, and if you have any ideas on converting visitors into customers, please share.
Hi, Justin! I realize that I am reading a relatively ancient post, and I’m not sure it there’s anything that’s outdated at this point, but… you mention the benefits of tying lead submissions as GA e-commerce transactions over GA goals, but aren’t there reasons to do it both ways? For example funnel visualizations and conversion rates by source, landing page, etc?
Shirlee
@Shirlee: Absolutely, you can do both a goal and an ecommerce transaction. As you indicate, setting it up as a goal let’s you create a funnel. But if you do set it up as a goal you can only apply a single value for conversion value. Whereas when you use this method you can create a dynamic value. I think the best way is a hybrid, use this ecommerce method and configure it as a goal.
Thanks for the comment, even on an ancient post.