Skip to main content
menu_icon.png

Everything you need to learn Optimizely X in one place: See our resource pages for Web Experimentation and Personalization.

x
Optimizely Knowledge Base

Redirect experiments: Test two URLs in Optimizely X

This article is about Optimizely X. If you're using Optimizely Classic, check this article out instead.
 
Relevant products:
  • Optimizely X Web Experimentation
  • Optimizely X Web Personalization

This article WILL HELP YOU:
  • Test two landing pages, homepagesor any other pages against each other
  • Set up redirect experiments (split URL tests), which redirect visitors from one URL to another
  • Ensure that you can track events on both your original and redirect pages

Redirects at a glance

Redirect experiments, or split tests, allow you to compare two separate URLs as variations in an A/B test. For example, you might create a redirect experiment that compares two versions of a landing page.

Tips

What to watch out for

  • Make sure your URL targeting doesn't capture both original and redirect URLs
  • The Optimizely snippet must be on the original and the redirected page
  • Don't remove the/* _optimizely_redirect=http:// */portion from code samples

Sometimes when testing out a major redesign or dramatic change, you may have two entirely separate versions of a page to compare.

For example, you may have two different landing pages or homepages with different URLs. Testing whole pages against each other is a great way to perform deep experimentation.

Redirect experiments work a little differently from other Optimizely experiments, so we've provided a checklist to help you set it up correctly. Use this list to walk through each stage of setting up a redirect:

Check for: Section:
1. Basic setup: Create the pages in "Implementation" Set up the pages
2. Create the experiment Create the experiment
3. Set up the redirect: Navigate to the variation and select Redirect  Set up a redirect variation
4. Goals: Add metrics to the experiment Add events as metrics

We have identified a condition that affects the accuracy of event-tracking for certain types of redirect experiments in Optimizely X Web. This feature is currently under maintenance. Learn whether your redirect experiment may be affected.

1. Set up Pages

When creating your redirect experiments, it's important that you first set up the two Optimizely pages within your Optimizely account.  These pages tell Optimizely where to run campaigns and experiments on your site. The reason you need to create the pages first is so that you can ensure that your metrics are tracked across both pages in your experiment.

For example, you run a retail site called Attic & Button and you want to test one homepage against a new version of that homepage.  Your new version of the homepage is hosted on a different URL and has updated branded images as well as new content.  You want your visitors to click on the CTA on the homepage that takes them to the relevant product pages, where visitor will learn more about the products displayed on the homepage.  The metric you want to track is clicks on the CTA on the homepage to those product pages.

You will need to create two Optimizely pages:

  1. One will be where the experiment will run (the original)
  2. One that will target both the original and the redirect page with the same metric

To create your first ("original") Optimizely page, follow the steps outlined here by targeting the single page.  After adding your first page,  add the second page with a slight modification.

For "page type", select "a set of URLs":

You will need to target both your original (i.e- "atticandbutton.us/homepage") and the redirect URL (i.e- "atticandbutton.us/v2").

Once both pages have been created in Optimizely, set up a new event on the second page by navigating to the "events" tab and creating a new click event.  To learn more about setting up events, click here.

It is important to run redirect experiments and track metrics that apply to both the original and the redirect pages.  We recommend running a redirect experiment on pages with similar actions to ensure the impact is tracked correct.  


2. Create a new experiment

Redirect variations follow the same six steps you use normally use to build an experiment, with a few differences. First, you'll set up the basic experiment as usual. You can change any of the components you add later, if you like.

Navigate to Create New... > Experiment to start the experiment flow.

  1. Add a page to tell Optimizely where the experiment will run. For a redirect, the URL usually points to your original homepage or landing page.

  2. Add the audience who will see your experiment.

  3. Add metrics you'll use to measure success.

  4. Adjust the split in traffic between your variations, if you like. The Original is your existing page; Variation #1 is the new page you're comparing it to.

  5. Click Create an experiment.

Make sure you have your Optimizely snippet included in the code for both the original page and the page to which you are redirecting in your variation. If it's not on the new page, your visitors may not all be tracked.

Experiments that redirect to a different domain may experience tracking issues for those redirected visitors. Learn more about cross-domain tracking.

3. Set up a redirect variation

Next, you'll set up a variation that redirects to your second homepage or landing page.

  1. Under Manage Experiment, select Variations to see variations you created when setting up the experiment.

  2. Select "Variation #1" to set up the redirect to your homepage to the new URL.

  3.  Then, create the redirect. Under Create Options, select Redirect:

  4. Add a full URL or a relative path where you'd like to redirect visitors.

    For example, if you're testing two versions of your homepage, enter the URL for the second version of your homepage here (the same URL that you added as a new page earlier). 

Based on your traffic allocation, visitors be randomly bucketed into one of the URLs that you entered.

When you load a redirect page, you won't be able to edit it with the Editor.  You'll see a prompt that prevents you from editing the page. 

4. Add metrics

You'll use events to track how visitors behave in the experiment.

To track events in a redirect experiment, you'll need to add two separate pages to your Optimizely project: 

  • A page with the URL for the original landing page

  • A page with the URL for the new (redirect) landing page

If you haven't added a page for the redirect, here's how to add one.

Next, add events to both pages to measure success. If you haven't set up any events, here's where to start.

  1. Navigate to the experiment. Under Manage Experiment, select Metrics to set your goals for this experiment:



    Click metrics to add them. 

    For example, add the "Add to Cart" click event, which is tied to your original variation, to track if your visitors are clicking this CTA (Call To Action). 

    The first metric you choose is automatically be your primary metric. When you add a second event for Variation #1, it will be added as a secondary metric.

  2. Once you've set up your experiment, double-check that each component is set up correctly. QA to make sure the experiment it looks and works the way you like. 

  3. Then, click Publish.

Congratulations! Your experiment is now live to the world.

Best practices

Indicate the canonical link. In order to improve SEO link and ranking signals, the redirected page should indicate that the original page is the preferred (canonical) destination.  Add a <link> element with the rel="canonical" attribute into the <head> section of the redirected page. Check out this Google Support Doc for more information.

Unblock Optmizely's redirect. By default, when you set a redirect, Optimizely blocks other redirects for 5 seconds so that you will not cause an infinite loop of redirects. Click to learn about unblocking the redirect.