Counting a conversion when a link is clicked using Google Website Optimizer
We recently needed to test the effectiveness of a new landing page. This is a classic A/B test so we used Google Website Optimizer (GWO) to set up and manage the test. Using GWO the way to implement this test is to add the Control script to original (A) page; the Tracking script to both the test pages (A and B); and the Tracking script for the Goal page. When the visitor clicks on the link (or button) for the Goal page, a conversion is counted.

Pretty straightforward stuff. Unfortunately in our case we were testing a new landing page and whilst we were able to add the Tracking code to the test pages, we weren’t able to add the tracking code to the Goal page.
So how can we implement the test without adding the Tracking script to the Goal page? Or, in other words, how can a you count a conversion when a link (or button) is clicked?
The trick is to add a Javascript function to the test pages which contains the tracking script for a goal in a onclick event. Thus when a visitor clicks on the call-to-action (which sends the visiter to the Goal page) the goal is counted by GWO.

The script and usage for this is as follows:
<script type="text/javascript">
function ConversionCount() {
var pageTracker=_gat._getTracker("UA-xxxxxxx-x");
pageTracker._trackPageview("/yyyyyyyyyy/goal");
return true;
}
</script>
<a href="goal.html" onclick="return ConversionCount()">Goal</a>
This method can also be used in situations where you need to count conversions on another domain, or where you want to track conversions such as the download of a PDF or a form submission.
Leave a Reply
About this blog
Double Jump Media are a specialist search marketing and search engine optimization company that helps you and your customers get more from your website.
Subscribe to our RSS feed
Search
Recent posts
- Four things your landing page must have
- Get visitor feedback with Kampyle
- Counting a conversion when a link is clicked using Google Website Optimizer
- Typeface.js: Last word not rendering in Internet Explorer
- Eye-tracking and usability testing with City University London
- Is on-site search failing your business?
- 5 SEO quick wins
- How important is on-site search?
Categories
- Feedback analytics
- Google Website Optimizer
- Landing pages
- Search
- Search Engine Optimisation
- Usability
- Web development