Advanced Google Analytics: Conversion Goals (Part Four)

June 5, 2008 in Analytics, Expert Advice

In part one of this series I covered the basics of setting up goals in GA (Google Analytics).
In part two I covered setting up funnels.
In part three I discussed tracking goals with no distinct associated pageview.

Today, in the final installment, we'll be discussing how to track the income from certain goals.  Google calls this "goal value tracking."

It's for those of you selling something. It allows you to track the income you make from a given goal. Having this extra information in your web analytics is very powerful in helping you make the right decisions.

Tracking income from your goals

Ok, there are three common scenarios where you want to track goal values.

Common Scenarios:

1) You have a lead generation form as your goal. You know that you typically convert 10% of your leads to a $100 sale. For your Goal value when you set up your goal, you'd put $10. You're done.

Like this:


2) You have a store, and you sell a $25 eBook, and you only ever sell one at a time. Put $25 as your goal value, and you're done.

3) Let's say you have a store where you sell any number of items and your final ticket value is unknown.

First - make sure you website profile in GA is set to be an E-Commerce site. To do this, login to your GA account, click Edit next to the website profile in question, then on the next page (Profile Settings), click edit in the upper right corner (on the "Main Website Profile Information" panel). Then look for this radio button and change it and your currency as appropriate:


Second, we'll be diving back into some javascript code as we did in part three, but if you follow along carefully it's not hard. It will, however, require some programmer intervention to get it right as the sale values must be dynamically loaded into the javascript below.

Before we go any further, you need to make sure you're using the latest version of the Google Analytics code on your site. To find and make sure you've got the right code, do the following:

  1. Load up GA.
  2. Click edit in the settings column for the website profile in question.
  3. In the upper right corner of the edit page, click the "Check Status" link (dumb, I know).
  4. Make sure you grab the "New Tracking Code." This should be the code you have in place throughout your site (not the legacy code).


Next, as we've discussed previously, set up your goal.

Here's an example:


Note I have 0 in the Goal value field, don't worry - we'll be creating that value dynamically in a moment.

Now - on your receipt page, in the code itself, you're going to need to call some javascript to register the sale with GA.

Warning: this is decidedly technical, so if this is mumbo jumbo to you, your programmer will need to help.

On your receipt page, below the GA tracking code, you're going to need to make three javascript function calls.

  1. pageTracker._addTrans() to register a transaction.
  2. pageTracker._addItem() to add the item(s) (you can call it multiple times, once for each product purchased).
  3. pageTracker._trackTrans() to send it all to the mother ship.

The parameters for these functions are outlined in the example below provided by Google. You or your programmer will need to populate in the values for each of those items when the page is rendered. In the event that you don't have (or want to record) a value (like, for shipping) you can put 0, or leave it blank.

That's it! I hope this little tour of the power of goal tracking in Google Analytics has been helpful to you.

<script type="text/javascript">
    "1234",                                     // Order ID
    "Mountain View",                            // Affiliation
    "11.99",                                    // Total
    "1.29",                                     // Tax
    "5",                                        // Shipping
    "San Jose",                                 // City
    "California",                               // State
    "USA"                                       // Country

    "1234",                                     // Order ID
    "DD44",                                     // SKU
    "T-Shirt",                                  // Product Name
    "Green Medium",                             // Category
    "11.99",                                    // Price
    "1"                                         // Quantity


Get free blog updates and tips by email

Is there any way of setting up multiple funnels for the same goal (i.e. there are several routes for customers to get to the same goal page on my website. The only way I can think of doing this is to set up the same goal 4 times and define 4 different funnels - one for each goal.

There must be a better way? Any help much appreciated.

Many thanks,

Posted by: Mitesh Patel | Jun 17, 2008 5:39:50 AM

Hi Mitesh, your suggestion is the only way I can see. Not ideal, but it should work. The unfortunate part is that Google only allows 4 goals. :(

Posted by: Carson | Jun 17, 2008 7:22:20 AM

This was a great post. I am in the process of setting up goals for several different sites. I wanted to know is there a way to track goals from an Affiliate ID or a campaign with a unique identifier? Basically we want to be able to tell where most of our goals are coming from. Thanks!

Posted by: James | Jul 8, 2008 7:29:27 AM

Hi James, yes. Look into campaigns.

Posted by: Carson McComas | Jul 8, 2008 9:05:47 AM

Thanks a lot Carson. That link was a great help. I found we can use the UTM variables to track campaigns and the goals the campaigns are responsible for. Good stuff.

Posted by: James | Jul 8, 2008 1:46:02 PM


For goal to work does the URL that the goal is set to have to pass in a users address bar?

Right now I am using /rvsssignup/google.html for my Goal, using exact match. When I put in the full URL in the browser and hit enter, Google recorded that goal. I have it setup to get called on click though so the URL will never get passed in a users address bar. So far I haven't gotten any recorded goals except for the ones I did.

Posted by: James | Jul 8, 2008 2:22:12 PM

"For goal to work does the URL that the goal is set to have to pass in a users address bar?"


The url either has to exist for real and pass through the user's address bar -- OR -- you have to use the javascript call to make GA think that the page was hit.


If you aren't having the visitor actually load that page, then you need to do something like: onclick="pageTracker._trackPageview('/rvsssignup/google.html')" on whatever they click.

Posted by: Carson McComas | Jul 8, 2008 3:50:51 PM

Thanks a lot for this. We are going to implement this. I was going to try building an actual "thank you page" to set as the goal page. But this may be simpler.

The form we have already has an OnSubmit declared. Can we have 2 OnSubmits in one form?

Posted by: James | Jul 10, 2008 3:16:05 PM

Well, sort of. You'll need to use javascript and make a single function that calls both of your things, and then call that function from the onSubmit action. Get someone who knows javascript to help you out, it's not difficult.

Posted by: Carson McComas | Jul 10, 2008 3:23:22 PM

Hi, I used this script below. Is it missing a quote after SignUP? Should it be enclosed in single quotes?


Posted by: James | Jul 11, 2008 12:42:33 PM


Posted by: Carson | Jul 11, 2008 3:03:10 PM