Split Testing and Tracking Scripts
Update 14 April 2008
Added table of contents and a list of links related to JavaScript and link modification.
Update 15 March 2008
Added link to Suite 101 Article covering dynamic redirect using JavaScript (here).
Update 21 February 2008
Added a link to the excellent AB Testing Step By Step for Beginners hub-page.
Landing page optimization starts with using a split testing script to enhance web site tracking.
By using a JavaScript split testing solution, you can avoid issues such as PHP programming and database management.
In this lens, we will look how to:
o Use free counters for split tracking;
o Use JavaScript to generate landing page splits;
o Perform landing page optimization;
and much more...
Fair warning : To enhance your landing page using split testing scripts affiliate tracking software, you will need to invest some time.
What's Here
Quick access for regular visitors to their favorite bits.
- Split Testing Theory Articles
- JavaScript Link How-To's
- Books from Amazon
- A B Split Testing Preparation
- The JavaScript Split Testing Script
- The Split Testing Script Landing Page
- Split Testing and Affiliate Tracking
- Affiliate Ad Tracking and Split Testing
- JavaScript Split Testing - Did We Help?
- Ask a Question / Show Me Squidlove...
Split Testing Theory Articles
- AB Testing Step By Step For Beginners
- Split Testing is a marketing term used to describe the process of measuring the performance of different pieces of content against each other. These pieces of content (email, web page, etc.) have to have some...
- A/B Split Testing
- At MarketingExperiments.Com, researchers test marketing programs to see if they really work. The site features unbiased data on: pay search engines, free-for-all link programs, ezines, web awards, free classifieds, affiliate programs, banner ads, or web cards, email promo.
- What You Never Noticed: How Google Uses Split Testing to Optimize Your Results
- Take a look at how Google uses split testing, with one example that, while not Earth-shattering, goes to prove that you do need to pay attention to how visitors react to pages...
JavaScript Link How-To's
A collection of articles for manipulating URLs with JavaScript
- How To Get URL Parts in JavaScript: JavaScript Tutorial Describing the Window.location Object
- This JavaScript Tutorial article explains the Location object, and how to retrieve the URL from it in several parts, including how to parse, split, and rebuild URLs.
- JavaScript Randomize Landing Page: Illustration of JavaScript Arrays, HTTP Redirection and Math.random
- JavaScript tutorial article showing how to set up an array, select an item at random, and use it to redirect the browser to one of a collection of possible landing pages.
- Dynamic Redirect with JavaScript: Split and Modify URL Using JavaScript to allow Dynamic Redirect
- JavaScript tutorial article explaining how to split and modify a URL using JavaScript to allow dynamic redirection of web site traffic.
Books from Amazon
Get to the Top on Google: Tips and Techniques to Get Your Site to the Top of the Search Engine Rankings -- and Stay There
Amazon Price: $19.80 (as of 11/15/2009)![]()
This is probably the best book on Google-specific SEO on the market. And, the techniques will work well for other search engines too; so it's useful across the board.
Why do you need it? One thing that split testing requires is a steady flow of traffic. Get the traffic flowing with this book - simple.
The 7 step process that Viney proposes will, provided you put in the leg work, generate top Google rankings. As long as you have optimized it correctly, this will funnel enough traffic to keep your split testing realistic.
A B Split Testing Preparation
A few steps that are required before the JavaScript Split Testing Script is Installed
A B Split Testing on 1 Element
Split testing is the process by which an element of a sales page is varied and the success metrics measured to quantify the effect.
The process is therefore quite straightforward:
- Choose an element to split test on (heading, price, color, etc.)
- Create two versions of the default page, each with a variation
- Track the success of each
- Repeat steps 1-3 with a new element.
The JavaScript split testing script approach reduces the necessity to have two variations on the default page. It uses JavaScript to adjust the element that is being split tested and modify the target links.
The result is that three pages are used - the landing page, and two Call To Action result pages (linked from the Offer).
To track these, each will contain a simple web counter - more on this later.
The JavaScript Split Testing Script
The actual split testing script details.
The following is a little technical. I make no apologies - understanding JavaScript will give you the edge in your marketing efforts.
Firstly, be aware that the script goes in a separate .js file. This is to hide it from search engines and inquisitive visitors.
The script itself is very simple, and has two tasks:
- Display varying split testing content;
- Change the target URL for the Call to Action.
This it does at random.
The script itself (the content of the abscripttest.js file) is as follows:
var split_Target_1 = "split_1"
// Put your own URL#1 here
var split_Target_2 = "split_2"
// Put your own URL#2 here
if (Math.random() > 0.5) {
document.getElementById('SplitHead').innerHTML =
"This Is An Awe-Inspiring Headline To Capture Attention";
document.getElementById('CTALink').href =
split_Target_1;
}
else {
document.getElementById('SplitHead').innerHTML =
"This Is A Variation on the Awe-Inspiring Headline";
document.getElementById('CTALink').href =
split_Target_2;
}
Feel free to copy and paste the above script for your own projects!
Explanation
The first few lines set up the two target pages for the test.
The line with Math.random in it just chooses a number between 0 and 1, and checks to see if it is bigger than 0.5 : 50% of the time one variation will be shown, and 50% of the time, the other one will.
The document.getElementByID lines choose the appropriate part of the page to alter.
The Split Testing Script Landing Page
The Split Testing JavaScript has to be used in the Landing Page.
The following is an example of the landing page for which the split testing is to be performed:
<html>
<head><title>This is Split Selection</title></head>
<body>
<h1 align="center" id="SplitHead" style="color:red">Default Headline</h1>
This is the content.<br/><br/>
It could also be split-tested.<br/><br/>
<h3><a href="no_split.html" id="CTALink">Call to Action Link</a></h3>
<script src="absplittest.js"></script>
<noscript></noscript>
</body>
</html>
Notice that we have supplied defaults for those browsers where the JavaScript is turned off. The CTA target page for these should not be one of the split pages, or the results will be skewed.
Other than that, the HTML is fairly straightforward. Another small point to note is that the IDs for the h1 and anchors have been set so that the JavaScript can access them.
If these are changed so that the ID does not match, then the default will displayed.
This could be useful to add elements that might change to the .js file, but then not use their IDs in the landing page so that only one variation is shown at any one time.
The excellent Dynamic Redirect with JavaScript article covers this in more detail, providing instructions on how to split and modify URL data with JavaScript. This can be combined with split testing very effectively.
Split Testing and Affiliate Tracking
The final stage, and some variations.
All of the above is useless without tracking. I personally use www.StatCounter.com to track all my pages, up to 500 visits. Beyond that I use the raw log files on the web host. You could make your own stat script...
Assuming that StatCounter is being used, three projects can be set up:
- The landing page;
- Split URL #1;
- Split URL #2.
Once reset, these will count the number of visitors.
To track them, it is necessary to compare the click through rates, for example, if 100 visitors land on the landing page, and 25 go to Split URL #1 and 75 go to Split URL #2 then the landing page will be optimized if the second variation is used as the control.
Beyond this, counters should be set up to see what the ratio of click throughs to sales is, per Split. This will enable you to complete the landing page optimization process.
Variations
One variation could be to change the price and not the headline. Remember that this can go up as well as down - try both variations, the results might be surprising!
Don't be afraid to create an A/B/C split test and change up other parts of the landing page. One golden rule : only ever change one on-page element at a time.
Affiliate Ad Tracking and Split Testing
How to test affiliate adverts and perform affiliate ad tracking with JavaScript split testing.
This is incredibly easy. All that is required is that alternative ad copy from the affiliate program is displayed in a div section by changing it's innerHTML attribute depending on the result of the Math.random function.
The only caveat is that the affiliate program has to provide the possibility to track the individual IDs used in the ad copy so that you can differentiate them.
If they do not do this, then it may be necessary to perform the split testing using two separate pages, and measure success by referrer ID.
JavaScript Split Testing - Did We Help?
Ask a Question / Show Me Squidlove...
-
Reply
- GoodAdvice GoodAdvice Jul 24, 2008 @ 12:12 pm
- Lovely Lens LeckyT
-
Reply
- benlagat benlagat May 28, 2008 @ 6:11 pm
- Wonderful! You have shared with us very valuable information through such a well created lens. Congratulations%u2026%u2026..I will share this lens with many others whom I know are desperate for such enlightening information. The use of software has steadily grown in proportion to the advancing technology and the need for appropriate information has never been felt before as it is now .Please also visit automated software test and find out how automated software test works, the need for automated software test and the associated costs to the use of automated software test.
-
Reply
- Jaeohe Jaeohe May 28, 2008 @ 9:01 am
- Great lens. Useful information. The facts in this lens are intriguing and informative. I do have a similar stuff Software Testing on Software Metrics describing Software Testing Templates, Software Testing Standards, Software Testing Companies. Please stop by.
Thanks.
-
Reply
- atina23 atina23 May 22, 2008 @ 12:07 pm
- Fantastic lens. More informative on the JawaScript Split Testing. I enjoyed a lot and could learn more from this lens. Nice work. Thanks for sharing. May I share with you such an informative site about Software Testing which I found on Testing Resources Feel free to open this site to find information about Automated Software Test, Automated Software Testing Tool, International Software Testing and much more about Software Testing.
- Reply
by LeckyT
Marketing is important, content marketing even more so. To get the best from your content, split testing and split tracking scripts can double your pr...
(more)





