We’ve been using a piece of code for a while that makes it easier to set up multiple Google Website Optimizer experiments. These experiments could be one right after the other, or even several experiments running simultaneously.
The only requirement is that you should have a single conversion point for all of your Google Website Optimizer experiments. You may be able to adapt this code to situations with multiple conversion points, but that’s likely to get rather complicated.
So why use this code? Oftentimes your conversion point is a page that you’re not really wanting to edit a lot, or may even be able to edit a lot. Instead of having to update your conversion page every time you set up a new experiment, you just add this code to your conversion page once and forget about it. It will register a conversion for all current and future experiments, and will even accommodate visitors who may be part of more than one experiment.
So here’s the code:
A few things to keep in mind:
- If you have your own functionally equivalent readCookie function, you can use that instead.
- This code will probably work best if it comes after your Google Analytics Tracking Code.
- If you have any kinds of modifications to your Google Analytics Tracking Code, you’ll need to make those same modifications to your Google Website Optimizer code. See Shawn’s post on this.
- This code is meant to replace the Google Website Optimizer conversion script that’s provided with your instructions.
That’s it! I always appreciate suggestions for improving code I put up here. If you’ve found this code to be particularly useful, I’d like to hear that too.