Adding tags for your A/B experiment

The first decision you need to make when adding tags is whether to install the HTML script tags yourself or have someone else install your script tags. This task needs to be done by someone familiar with HTML and with the structure of your webpages. Also, be aware that this script sets a cookie, so you might wish to ensure that your site's privacy policy covers the setting of cookies.

If you want to install the tags yourself, you will have to insert scripts on three pages.

1. Adding the control and tracking scripts to your original page

The control and tracking scripts for your test page are given to you as one combined block of code. The control script ensures that the experiment variations are switched randomly and that all variations are displayed an equal number of times, while the tracking script ensures that visits to the page are recorded in the experiment. Place the combined block of code immediately after the <head> tag. For example, your test page will look like this if it has the scripts properly installed (scripts in bold):

<head>

 <!-- Google Website Optimizer Control Script -->
  <script>
  function utmx_section(){}function utmx(){}

   ... More contents of your control script ...

  '" type="text/javascript" charset="utf-8"></sc'+'ript>')})();
  </script>
 <!-- End of Google Website Optimizer Control Script -->

 <!-- Google Website Optimizer Tracking Script -->
  <script type="text/javascript">

   ... More contents of your test page's tracking script ...

  s.parentNode.insertBefore(ga, s);
  })();
  </script>
 <!-- End of Google Website Optimizer Tracking Script -->


 ... Any other contents in your header section ...

</head>

2. Adding tracking scripts to your variation pages

Place the tracking scripts designated for your variation pages immediately after the opening <head> tag on each variation page. For example, your variation pages will look like this if they have tracking scripts properly installed (tracking script in bold):

<head>
 <!-- Google Website Optimizer Tracking Script -->
 <script type="text/javascript">

   ... More contents of your variation page tracking script ...

  s.parentNode.insertBefore(ga, s);
  })();
 </script>
 <!-- End of Google Website Optimizer Tracking Script -->


 ... Your variation page's header contents ...

</head>

3. Adding the conversion script to your conversion page

Place the conversion script immediately after the opening <head> tag on your conversion page. For example, your conversion page will look like this if it has its conversion script properly installed (conversion script in bold):

<head>
 <!-- Google Website Optimizer Tracking Script -->
 <script type="text/javascript">

   ... More contents of your conversion page tracking script ...

  s.parentNode.insertBefore(ga, s);
  })();
 </script>
 <!-- End of Google Website Optimizer Tracking Script -->


 ... Your conversion page's header contents ...

</head>

4. Validating pages

Once you've installed all the tags, click “Validate Pages”. Our validation tool examines your pages and verifies that the tags have been installed properly. If the validation tool detects any problems with the installation, you'll need to fix these before continuing. Website Optimizer won't let you go on to the next step without validation. If you're unable to validate the tags at the moment, you can click Save your progress and finish later.

Once your pages are validated, click “Continue” to preview and start your experiment.

Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue