- Optimizely Classic
This article will help you:
- Test two homepages against one another
- Set up redirect experiments (split URL tests) in Optimizely Classic, which redirect visitors from one URL to another
- Ensure that you can track goals on both your original and redirect pages
- Understand why your redirect variation might be reporting 0 conversions on the results page
- Create an experiment that modifies the URL, or other advanced redirects
Redirect experiments 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.
- Use redirects if your variation code exceeds 200 lines
- Check Redirect with live query parameters included to keep the parameter attached in the variation
- Use goal targeting to track clicks on the redirected variation
- To map and test multiple URLs in a site redesign, use redirect URL mapping
What to watch out for
Do you have two landing pages to compare? Or two separate versions of a page? You can create "split URL" experiments that simply redirect a visitor to a different URL as a different variation. This means you can use Optimizely to easily test whole pages against each other.
Want to see how to setup a redirect experiment and follow along? Watch our two-minute video on setting up a redirect test.
Have a question about setting up your experiment? Head over to the Optimizely Community to post a discussion and see what others are talking about.
Redirect experiments function a little differently from other Optimizely A/B experiments. When you create a redirect experiment, use this checklist to make sure that you've set it up correctly. Each section in this article will help you set up your redirect experiment per this checklist:
|Basic setup: select Redirect to a new page from the Variation menu||Setup|
|URL Targeting infinite loops: make sure your URL Targeting doesn't capture both the original and redirect URLs||Setup: URL Targeting|
|Goals: Set up Goal Targeting if you're tracking a click goal on the redirect page||Tracking Clicks (Goal Targeting)|
|URL Modifications: Customize the experiment if you want to modify the URL upon redirect||Advanced|
Set up a redirect variation
To create a variation that redirects a visitor to another page, just follow these instructions:
In order to improve SEO link and ranking signals, the redirected page must indicate that the original page is the preferred (canonical) destination. To do this, 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.
- Create a new experiment and choose one of the pages that you want to test as the URL. This will be your "original" variation.
- Click the Variation menu and select Redirect to a new page...
- Now, enter the URL of the other page that you'd like to test in this experiment. Based on your traffic allocation, visitors will now be directed to either of the URLs that you've entered.
When you load a redirect page, you won't be able to edit it in the Editor. You'll see a prompt that prevents you from editing the page. If you need to track clicks on your redirect page, see the section on goal targeting in our click tracking article.
- When setting URL Targeting, don't target the redirect page or use a substring match that targets both the original and redirect pages! If you do either of these, you'll cause an infinite loop of redirects that causes your experiment not to activate. For example, if you're running a redirect test between myfakesite.com/lp1 and myfakesite.com/lp2 then don't substring match myfakesite.com. Most often, you'll want to use a simple match on your original page's URL.
- Redirecting with query parameters: If you have URLs with dynamic parameters that you want to keep when you redirect to the new page, click the option to Redirect with live query parameters included. For instance, if a visitor lands on example.com/original-page/?test=true and gets redirected into the variation, they would be redirected to example.com/redirect-page/?test=true. If this setting wasn't checked, the visitor would be redirected to example.com/redirect-page without any additional query parameters.
- Want to track a goal on your original and redirect page? Keep reading -- we walk through this process in the "tracking clicks on a redirect page" section below.
Make sure you have your Optimizely snippet on 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. Please refer to our other knowledge base article that details this topic and explains further.
Goal targeting: Track clicks on a redirect page
If you are looking to compare clicks on elements between a page and the redirected page, you'll need to use goal targeting to make sure that Optimizely will track clicks on both your original and redirect page.
If you start your experiment and notice that your redirect variation is not recording any conversions, you most likely have set up goal targeting incorrectly (or not set it up at all). Read the following section to find out more on how to set up goal targeting.
- Go to your original page in the Editor. Click the Goals icon () in the top right of the Editor.
- Click Create a New Goal.
- In the goal tracking dialog, choose Click Goals from the drop-down menu and name the goal.
- Now you'll choose the element that you want to track clicks on. Click to see your full page if you need more space to find it.
- Select the element you wish to track on your original page; you will see the element highlighted in red. A red border will appear around it.
- Now, you'll find the element in your redirect page. Here's how: Look for the URL used for preview below field and change it to the URL of your redirect page. Now hit Enter/Return to see the page.
- Select the element you wish to track on your redirect page; you will see the element highlighted in red. If the item is already highlighted in red, you shouldn't take any additional action.
- Click if you had expanded the page.
- Click the Advanced link at the bottom of the window, to open the Advanced tray.
- Under Goal Targeting, select Specify custom pages on which to track this goal, and enter the URLs of your original and redirect pages. Use the + button to add more URLs.
If you're curious about what's going on in these steps, here's what you're doing: by default, all click goals will only be tracked on pages that meet the experiment’s targeting conditions. When you wish to track a click goal on a page that exists outside of the targeting conditions you must manually specify these pages.
- You can use the same match type conditions as in URL Targeting, i.e simple match, substring match, exact match. But for a redirect experiment, you will typically want to use Simple Match on the original page URL and redirect page URL.
- Click Save. Now your goals will track for both your original and redirect pages!
Before creating goals for your experiment, please ensure the Optimizely snippet has been added to any page on which you wish to track goals.
Unblock other redirects
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 more or remove the automatic redirect check.
In our developer docs, we outline several advanced use cases for redirect experiments that involve adding custom code to the Edit Code box, such as:
- Redirect a visitor to a new URL and add a query parameter
- Redirect a visitor to a new path but preserve the rest of the URL
- Redirect the visitor to a new domain but preserve the rest of the URL
- Redirect the visitor to a new URL while preserving hash parameters
When you use the code samples, make sure to keep the /* _optimizely_redirect=
http:// */ portion of the code. This is necessary to tell Optimizely that this is a redirect variation. You can replace the "custom" portion with an alternate string of your choice (it displays in the pop-up in the Editor) but the http(s)-protocol IS important.
- Load the page you want to use as the original page. If you want to modify multiple pages just select one at random and load that into the editor.
- Click the Variation menu > Redirect to a new page... When the dialog comes up, leave the example URL in there, and uncheck the Redirect with live query parameters included checkbox.
- Click the Edit Code box at the bottom of the page, and enter the code from the developer docs, replacing the dummy text where necessary.
Keep in mind that if you are adding a new URL parameter, it will append to the currently loaded URL. If the currently loaded URL already has a URL parameter, you will need to use '&'. If it does not, you will need to use '?'.
When you do a preview in Optimizely, we use our own URL parameters, so be aware that when the experiment is running live, those parameters won't be there.