When you set up an AB Experiment through Google Website Optimizer, it expects you to have a few separate pages:

The Control Page

The Variant Pages

The Conversion Page

For most websites this isn’t a problem, but what if you’re unique? What if you don’t have a typical conversion page to thank the user?

Don’t fret – we’ll show you how to trigger that conversion script if your end goal is a download, redirect, or something else non-standard. You can even use these techniques to confirm your visitors are actually reading your copy.

Triggering On Click

If your goal is to have your visitors download a file or submit a form external to your site, triggering the conversion code on click is your solution. Let’s first look at the standard conversion script given by Google:

It’s important to know that only the code in the try-catch block actually triggers the conversion, the prior code is just setup. If we load the setup code normally, but only trigger the conversion code on a specific event then we have a powerful mechanism. Here’s an example:

Note that you can use this for events other than onClick, such as onMouseOver, onSubmit, etc. Make sure to have the event handler return true, otherwise the action following it (the download, the form submission, etc) will not execute.

Triggering On Redirect

What if your goal is to have your visitors visit another site, or go to a page that you don’t have code access to? Simple – create a redirection page that will trigger the conversion script, then redirect. Change your links to point to this redirection page. Use the following code as an example:

Some people rely on using a meta-refresh redirect, but the above method is more reliable and it gets recognized by Google’s verification process when making sure you have the code installed properly.

Triggering On Delay

Many of you know that a one second visit to one of your pages probably isn’t productive. That’s why it can be useful to track if the visitor stayed on your page for at least a specific amount of time. Using the same approach as our ‘On Click’ technique above, we can do just that. Use the same block of code in the head, but instead of calling the reportConversion() function on an event, just set a delay:

The time is measured in milliseconds, so 5000 equals 5 seconds. This will show you that your traffic is actually reading through your site, as opposed to just quickly scanning and leaving.

More applications

I know you’re thinking – “Well great for A/B testing, but I run multivariate experiments.” No worries! You may have noticed that the Conversion Page scripts use the same code (except for the unique ID’s), so feel free to use these same techniques.

Glad to hear it! If you wanted to track a click on a Paypal button, go ahead and try copying the first example above - loading the google optimizer code and then creating the reportConversion() function. The code would go on the page that your paypal button is on.

Setting an event handler is done by this line of code: onClick="return reportConversion()"
The "event" is 'onClick', and the "handler" is the 'reportConversion' function that's being called.
This should be on the submit button that Paypal gives you.

Hope that helps - please don't hesitate to let me know if you need further assistance!

Christina

Thanks so much for this! If you want to test multiple things like
the time spent on the page
an actual conversion page
etc
do i need to create different test for each different thing I want to test? Or is there a way to test them all at once??

The time spent on a page isn't exactly something to test, it's simply the trigger that marks a conversion. And the conversion page isn't being tested either, it's the page that normally has the code on it that reports a conversion. What is being tested is the page that inspires the user to make your desired goal.

Rene

lee

Is it possible for me to create two versions of my home page to test? I currently have a high bounce rate on the index.asp and would like to change layout and content on this and save it as a different version.

I just want to test if my bounce rate changes and not the converstion rate

Lee -
Excellent question. I would suggest creating two home page variants and setting them up in Google Website Optimizer so that it splits the traffic (don't worry about a conversion page). Then you can monitor the bounce rate using Google Analytics (just make sure your analytics code is after the optimizer code on the baseline). If that doesn't work, the next approach to try (although cumbersome) would be to use the onClick method described in this post on every link.
Good luck!

Sammy

I have similar situation as Lee, I wasn’t sure if I should measure the bounce rate or the click conversion on homepage.
When you said don’t worry about conversion page, what the URL that we put into the conversion page filed? It’s a dummy URL page?

And If I decide to use the onClick method for links on homepage. The conversion page will contain just the Conversion Script, isn’t ? no actual content in there. Sorry if these are stupid questions, I’m quite new to this.

Yes, Google asks for you conversion URL just to verify that you installed code correctly - after the setup process it isn't used anymore. Go ahead and put in a dummy URL. It will tell you there were problems, but if you continue anyway there will be no side-effects.

Great point. Yes, you can have duplicate content issues, but there are steps you can take to avoid this.
See this link for more details:
http://www.google.com/support/forum/p/websiteoptimizer/thread?tid=3b02c74edaeaab25&hl=en

Good question - To my knowledge, you aren't able to track multiple goals for GWO. Someone proposed a workaround for this, but it doesn't seem to be very successful: http://tech.groups.yahoo.com/group/webanalytics/message/23401

You may want to consider tracking this in Google Analytics. I know you can set up multiple goals in there, and further your analysis by reporting within funnels. That's beyond the scope of this post, but you may be able to mimic some of the same concepts here, but calling the tracking function on an action instead of on load.

Well I saw you guys were naming things differently so I tried it one time with exactly their code as they say to do it on that page mentioned, and another time with your code exactly as you show above, and both time I can't get past the error checking.

(Originally I was doing a combination of the two and I got past the error checking but no conversions were being tracked. I notice that you are calling it conversion scripts and google is calling it tracking script and I don't know what the difference is.)

Unfortunately it does not allow you to go to the next step if you don't pass error checking. Unless you can tell me a way to do it.

This is making me crazy because I tried the code exactly as you have it here, it didn't work. Then I tried the code all the way it showed on that google page, it didn't work. Lastly I took the code that is generated in my account and inserted the code they said needed to be inserted, and that didn't work either.

But it's almost impossible to debug because their error checking isn't consistent. One time it will tell me the code works and then I will run it again with the very same code and it will tell me it doesn't validate. Is there some type of delay, you have to wait a certain amount of time after changing a page? It's maddening.

Hey Cindi - How frustrating. I don't think there is a delay. In the past, Google would give you an error message saying that the code isn't installed correctly, but there was still a way to ignore the warning and continue to starting the test anyway. If they have changed this, then I'd suggest following up with them, especially since that link you provided told us to do just that. Good luck!

Validation is very frustrating. I agree. I believe you can just feed them any page to validate with the proper code on it (just save a blank HTML page with your tracking code in the head). This will allow you to start the test. Hope this helps, nice article.

Khuram Malik

I supplied a dummy page with valid html for my conversion page which validated fine.

However, having now checked the report results a few days later, its logging visitors but no conversions even though my contact form was filled in (which was the conversion). I suspect this is because i supplied a dummy URL as the conversion page, which doesnt match where the GAQ data is being pushed from.

Any ideas on what URL i should be supplying as the conversion page since im using javascript events as the conversion?

Or do you think perhaps the problem im experiencing is related to something else?

Hi Khuram - My hunch is that the problem is related to something else. Google just uses the conversion url as a way to double check you installed the code, and shouldn't be using it to count conversions.

Most people have this problem when their pages are on different domains. If that is the case, make sure you're using the cross domain google optimizer scripts.

I used your "On Redirect" method, I'm using an external checkout page.

I also wanted to add that I'm using WordPress and as far as adding different tracking codes to the header of each variation, WordPress has one universal header for every page/post. But if you search for "Google Optimizer for WordPress", you'll find a plugin that adds the proper fields to your page or post editing screens and you can add the specific tracking codes to your pages.

It worked great for me and combined with your redirect method, everything worked out perfectly and validated. :)

Based on http://static.googleusercontent.com/external_content/untrusted_dlcp/www.google.com/en/us/websiteoptimizer/techieguide.pdf

I am not sure what portion of the code to separate and wrap in a function to call from the on click event.

Second, I am considering just presenting two different styles of social icons. I uploaded them to the server but I am clueless how to make google serve one or another and only place the onclick event on the one that I think conversion happens. (Only one variety should call the conversion method)

Am I completely off the track about this? I would appreciate any response when you have time.

Thanks for the kind words. You’ve noticed that Google has changed quite a bit since this article was written. In fact, they don’t even call it ‘Google Website Optimizer’ anymore (now ‘Content Experiments’).

I have not had the chance to test this out with the new code, but we’ll try and examine it sometime soon and post a follow-up article.

Testing two different styles of social icons is a great idea. I’d suggest posting to a forum site that may be able to give you specific help on your current situation. Here’s a site that may help: http://stackoverflow.com/questions/tagged/google-experiments