Taken from but altered slightly: http://support.google.com/websiteoptimizer/bin/static.py?hl=en&topic=29622&guide=29619&page=guide.cs#m2
The control script goes on your test page and makes sure that the experiment variations are switched randomly and that all variations are displayed an equal number of times.
The tracking script goes on your test page ensures that visits to the page are recorded in the experiment.
The control script immediately after the head tag.
mv_head(k, ua, pv, gv)
k: the value listed in the control script:
{var k="#{k}" # Example: 262340015
ua: the Account number listed in control script:
_gaq.push(['gwo._setAccount', 'ua']); # Example: UA-46835225-6
pv: the track page view link listed in control script:
_gaq.push(['gwo._trackPageview', '/pv/test']); # Example: 6234623
The page sections script is used to mark the elements that will be varied during the experiment. Essentially, you need to use the script provided by Website Optimizer to define the beginning and end of each element. For each element, you will need to name the page section in the script. As an example, let's say you defined a header that welcomes people to your page. The starting HTML code looks like this:
<h1>Welcome!</h1>
After adding your section script, the header will look like this (with the custom name "Headline" for this section in italics):
<h1>
<%= mv_begin_section("Headline") %>
Welcome!
<%= end_section %>
</h1>
in HAML a link might be written as:
= link_to (mv_begin_section('Headline') + "Welcome" + mv_end_section)
Conversions are initiated via a javascript function 'doGoal' You'll need to add a snippet of text to the link / links that you want to track as a conversion. Let's say your link looks like this:
<a href="http://www.example.com/promotion">Featured Products</a>
To count a conversion when this link is clicked, add:
onclick="doGoal(this);return false;"
to the HTML tag. The new link will look like this (addition in bold):
<a href="http://www.example.com/promotion" onclick="doGoal(this);return false;">Featured Products</a>
You can modify as many links as you want to count as a conversion, but all of them will be counted identically as conversions in your experiment results. In other words, Website Optimizer will not differentiate between them when reporting conversions.