Nethab Blog

Google Website Optimizer in an external JS file

Posted by Nethab at 11:27 AM

An external ".js" file can come in handy when you use a content management system, templates (or server-side-includes) and/or have a large site and want to test a large number of pages simultaneously. Thanks to some modifications to the GWO scripts made by ShoreTel it is now possible.

How-To

The first thing you will need to do is set up your experiment as normal (using the instructions provided by Google) in order to get your experiment "verified". I use "dummy" pages and the upload verification method so I don't have to mess with any real pages on my site.

Then you will take the section names you defined in your experiment above and "tag" the portions of your page with an ID parameter.

For Example: If your section name is "heading", change the ID of your heading tag like this:

<h1 id="heading">Original Headline</h1>

Any text or content within that tag will be replaced by the variations you defined for that section of the experiment.

The next step is to paste the scripts below into your <head>, substituting the experiment key you received (from GWO) for the control scripts, and the profile ID you received for the tracking scripts.

For Example:

<script type="text/javascript">
var _gwoKey = "XXXXXXXXX";
var _gwoUacct = "UA-XXXXXX-9";
</script>
<script type="text/javascript" src="/<your folder>/gwo.js"></script>

Download Sample

Labels:


Subscribe to: Posts (Atom)