How to Install Google Website Optimizer on WordPress for Affiliate Offers
TweetThe following is a guest post by Jason Capshaw
It is much easier to double your conversion rate, than it is to double your traffic. One of the key components of conversion rate optimization is testing.
Google Website Optimizer was built for that very reason and is designed to give you the ability to test different ideas against each other in real time and see what works and what doesn’t.
Unfortunately, it does not seemlessly work with WordPress. In a typical setup, Optimizer would track visitors all the way to a confirmation page. Since most affiliate offerings require you to link outside of your site, you have no way of monitoring which pages perform the best. This tutorial is designed to show you how to track link clicks within your affiliate pages without requiring a confirmation page.
Step One
Setup your Google Website Optimization account.
Go to Google Optimizer and login. Click on “Create a new experiment”.
Step Two
Choose the multivariate experiment type.

Step Three
Check the “I’ve completed the steps above and I’m ready to start setting up my experiment” box and click “create”.
Step Four
Fill out the experiment details.
In this section you will name the experiment and specify the page to be tested. Put the test page as the confirmation page as well because we will be monitoring clicks on this page.

Step Five
Check the “You will install and validate javascript tags” and click continue.
Step Six
Install this WordPress Plugin and navigate to the page you want to test in the WordPress Admin Section.
You will see this below your WordPress text editor:

Step Seven
Install the control and tracking scripts inside each section.
Google provides you with several different scripts that must be placed within the test page for the experiment to work. The plugin has color matching boxes for the scripts which make it easy to match.
Place the control script in the control box and the tracking script in the tracking box.
Step Eight
Edit and install the conversion script.

The conversion script is designed to detect someone entering the confirmation page from one of the experiment variations. We have to edit the code to track link clicks.
This is how the code will look:
<script type="text/javascript">
if(typeof(_gat)!='object')document.write('<sc'+'ript src="http'+
(document.location.protocol=='https:'?'s://ssl':'://www')+
'.google-analytics.com/ga.js"></sc'+'ript>')</script>
<script type="text/javascript">
var gwoTracker=_gat._getTracker("UA-XXXXXXX-X");
gwoTracker._trackPageview("/YYYYYYYYYY/goal");
</script>
This is the edited code that you will use to track the link clicks:
<script type="text/javascript">
if(typeof(_gat)!='object')document.write('<sc'+'ript src="http'+
(document.location.protocol=='https:'?'s://ssl':'://www')+
'.google-analytics.com/ga.js"></sc'+'ript>')</script>
<script type="text/javascript">
function doGoal(that) {
try {
var gwoTracker=_gat._getTracker("UA-XXXXXXX-X");
gwoTracker._trackPageview("/YYYYYYYYYY/goal");
setTimeout('document.location = "' + that.href + '"', 100)
}catch(err){}
}
</script>
Make sure that you replace the “UA-XXXXXXX-X” and /YYYYYYYYYYY/goal with the numbers that are in your original script.
For more information on this, visit Google’s help page.
Step Nine
Add conversion code to links.
In order to monitor specific links, we must add a snippet of javascript to each link we want to track.
This is a normal link:
<a href="http://www.example.com/promotion">Featured Products</a>
This is the link with the tracking installed:
<a href="http://www.example.com/promotion" onclick='doGoal(this);return false;'>Featured Products</a>
Step Ten
Set up the content test section.
Google provides two pieces of code that you put above and below each section that you want to test. In this manner, Google automatically replaces and switches between different content to test variations.

You can wrap the whole post with it or just specific sections of the content. I like to wrap the first paragraph, the body section and the call to action section.

Step Eleven
Install the headline and CSS page sections.
The headline of your blog post is probably the most important feature that needs to be tested. In order to test the headline you will need to make some light changes to the theme files.
Open up your single.php (for blog posts) or page.php (for pages) and header.php inside of the theme editing section of WordPress. Add the page sections to the headline and the CSS call.
CSS:

Headline:

Click the validate button and make sure there are no errors before continuing. It will let you know how many page sections you have available to edit.
More than likely you will get the following error:

This is due to the fact that the control script is not directly underneath the first head tag. Go into your header.php and move it (if it exists) or create it.

Step Twelve
Finally, create your variations.
Once everything is validated and you can now start creating page variations. Simply click add variation under each page section you want to test.

Happy testing!
Jason Capshaw is founder of MyWebTronics, an Atlanta web design firm.
Tweet
Tags: Conversions, Google Website Optimizer, Jason Capshaw
Share and Bookmark This Post













If you feel my blog has contributed to you in any meaningful way, and would like to throw some loose change into a tip jar (metaphorically speaking), a click on the donation button below would definitely be appreciated.
I think what you need to do is focus on the site you are building not on the hosting. If your site is developed with google guidelines on mind and with a link building campaign you will have good rankings.
I’m not sure I understand the point, as it relates to this post. Can you explain?
Awesome post, I’ve been looking for a simple way to setup GWO w/ WordPress affiliate sites for ages.
Richard’s last post ..How to Win Friends & Influence People in SEO
Great Post!
But I’m stuck on-stupid on step 11.
Css, php, javascript its all Greek to me.
I was in the header.php file of my theme and I looked at what you did and thought about copying you.
But as I looked at the two files carefully they did not seem enough alike for me to know just what to do.
In my opinion your site is the best on the internet on this very important topic.
That being said I’m totally in the dark on where to correctly place that code.
To complicate matters further or maybe not? I’m using FlexSqueeze for my theme.
Does that perhaps mean I should use Flexsqueeze.php?
One final thought, I don’t see my actual title in my header.php file. Does that matter?
My question, I guess is, is there a specific, predictable section in the header.php file where each time I can start my script, add the name of my script and end it?
Thank You,
You should be able to place the code that goes in header.php just before the < /head > tag. Then in single.php, you’re looking for code that includes “the_title()”.
Thank you for your reply Donna,
but let me try to test my understanding of it.
Does your answer mean that in order for me to add the page section script for the header that I must make a change in both the header.php file and the single.php?
If your answer is yes, then you have helped me already in a painful way.
Painful because I thought we only had to make a change to one file not two.
Which begs this question:
Do we start the code section in one file
and end it in the other or do we put the whole script in both?
Thank You,
Jerry
Look carefully again at the images in Step 11 above. You’ll see exactly which bits of code to put in each file.
My last question was a poor question,but I asked it before I reviewed your diagram again.
Hopefully this will be a better question.
First, I found both parts that you mentioned in your first response.
But what do you put between the and sections?
Where is the source of the information you put between and ?
I’m completely lost there.
In other words, how did you know to put in the header.php file ” or in the single.php file ” ?
Is it because you know php or css?
Thank you,
Jerry
Donna,
Your page script “deleted” code references I made in my previous post, so much so that it makes no sense whatsoever and I would respectfully ask that you delete that post and this one (after reading it).
Thank You,
Jerry Samuels
Yes WordPress does delete code so your question is muddled, but I still understand the basics of the question. One thing to note is that although I’m answering your questions, Jason Capshaw wrote the post, so how he knew where to place things is not something I can answer. But, in general, yes, I’d say it was simply experience with php and css coding, as well as experience with WordPress itself.
Hello Donna,
I just got my first multivariate test “validated”.
And I wanted to say thank you for your help!
Your post by Jason Capshaw was my primary inspiration.
An Andy Beard multivariates test video was also helpful.
In the end I got the job done by consulting professionals.
I was surprised. Most programmers and freelancers will
not touch multivariate testing. This stuff ain’t no joke.
So it was well worth the cost to me to find someone who could help me. The cost was very reasonable.
Without his help and that of his assistant Muhammed Khalid, I would simply have given up.
For the benefit of your audience,
Nabeel can be found at Guru. And I would highly recommend him for those of us who simply cannot figure it out on our own.
Again, I would like to say thank you for your help and I have been completely dazzled, Donna!
Jerry Samuels
Very glad you got it worked out. And yes, sometimes it’s best to just get help from those who have experience. Other times, it’s loads of fun to figure it out yourself. Either way, it’s great that you made it happen.
Hi,
Really interesting and really informative on a topic and I am desperate to get into. My problem though is that my affiliate sites aren’t on WordPress but are coded in standard HTML but i still need to track clicks, not conversions. Presumably I can follow most of these steps but I got confused by the steps which require a wordpress plugin to be installed, I’ve never used WP before and don’t really understand what the equivalent would be. Any help would be very greatly appreciated.
Thanks, Steve
If you just want to track clicks, you just need an analytics package to do that. Clicky will do that for you. Once you’ve set it up, just go to the reports, click on outgoing links, and you can see what links were clicked.
Sorry, don’t think I made this very clear. I want to do the MVT / AB testing of website optimiser but as an affiliate I need to track which of the tested variants leads to the most clicks, not to the most conversion but I don’t use WordPress, I have static HTML coded pages with affiliate links to merchants
I’m not sure that’s completely possible, but what I’d probably attempt to do is 1) Go to http://www.google.com/websiteoptimizer and follow the instructions to set up an experiment. I’d probably make up a conversion page (fake). Then, 2) set up Clicky. Although Google’s optimizer will never show any conversions, it should at least vary the pages shown. Then you can track which links got clicked via Clicky. (You’d probably have to make the links slightly different on the pages, so you know which were clicked. You can usually add a tracking code to an affiliate link for that purpose).
That’s not a perfect solution, and there may be better ones, but it’s all I can think of to try.