Create a redirect test
A redirect test, (a.k.a. split URL test), is a type of A/B test that allows you to test separate web pages against each other. In redirect tests variants are identified by URL or path instead of an element(s) on the page. Redirect tests are useful when you want to test two very different landing pages, or a complete redesign of a page.In this article:
- Create a redirect test
- Create a variant using a redirect destination
- About redirect destinations
- Query parameters in redirect destinations
- URL fragments in redirect destinations
- Relative paths in redirect destinations
- Trimming redirect destinations
- The Objectives tab
- The Targeting tab
- Check your rule
- Start your experiment
- How long should your experiment run?
- Define a canonical URL
- Troubleshoot redirect experiments
- Related resources
Here's a checklist of items that must be completed before creating a redirect test:
- Create your web page variant(s) outside of Optimize and have the URLs ready.
- Deploy the Optimize snippet and Analytics tracking on your original page.
- Check that your redirect pages include Analytics tracking and that this is the Analytics property ID you linked to from Optimize. The Optimize snippet isn't required on redirect pages.
- Check that your redirect destinations are on the same domain. Cross-domain redirect experiments aren't supported at this time.
Create a redirect test
To create a redirect test:
- Navigate to your Optimize account.
- Click on a container to get to the Experiments page.
- Click CREATE EXPERIMENT.
- Enter an Experiment name (up to 255 characters).
- Enter a fully-resolved Page URL (not a redirect).
- Click Redirect test.
- Click CREATE.
Create a variant using a redirect destination
After creating your experiment, you’ll arrive at the experiment details page. From here, you can create a new variant using a redirect destination:
- Click CREATE VARIANT.
- Enter a Variant name (e.g. "
- Enter a Redirect destination (e.g. "
- Click ADD.
About redirect destinations
A redirect destination can be either an absolute URL (e.g. "
http://www.example.com/variant.html") or a relative URL (e.g. "
/variant.html"). You can omit the domain/hostname and use a relative URL if the Final URL is on the same website. You can also use parent directory references (e.g. "
../") in redirect destinations.
When you enter a relative URL as a redirect destination, it's resolved in the context of the URL where the redirect experiment is applied, also known as the Source URL. Query parameters and URL fragments in the Page URL and Redirect destination are merged to produce the Final URL.
If a user arrives with conflicting parameters, the parameters entered when creating the Optimize experiment override any common parameters that the user arrives with.
Example – Parameter conflict
In a conflict between a Page URL parameter ("
s1=v1") and a Redirect destination ("
s1=v3"), the Redirect destination parameter ("
s1=v3") wins and overrides the Page URL parameter.
- Page URL – (a.k.a. Original URL, Editor page) The URL entered when creating the experiment as the page you'd like to test. It's used to generate the example fully-resolved Final URL for where the redirect experiment will send the user. While it isn't used for targeting at runtime, Page URL provides an example of where the Final URL will resolve and serves as a template for the URL targeting criteria.
- Redirect destination – The URL of the variant.
- Source URL – The page where the redirect experiment is applied. Matches the targeting rules for the redirect experiment where the redirect action is applied.
- Final URL – The ultimate page where the user is redirected when the redirect experiment is applied. Contains merged query parameters from the Page URL and the Redirect destination. Final URLs include "
utm_expid" for tracking and "
utm_referrer" for the referral from Source URL to Redirect destination.
Learn more about these and other testing terms in the Optimize glossary.
Query parameters in redirect destinations
Query parameters from the Source URL and Redirect destination are merged to produce the Final URL. If users arrive with conflicting parameters, the parameters entered during experiment setup override any parameters in the Source URL.
Example 1 – Parameters don't conflict
If query parameters in the Source URL and Redirect destination don't conflict, the Final URL will contain both.
Example 2 – Parameters conflict
If query parameters in the Source URL and Redirect destination conflict, common query parameters in the Redirect destination override and appear in the Final URL.
URL fragments in redirect destinations
A URL fragment, or fragment identifier, is the portion of a URL after a hash sign (e.g.: "
URL fragments from the Source URL and Redirect destination are merged to produce the Final URL. URL fragments behave like query parameters and follow similar rules. If a user arrives with conflicting URL fragments, the fragments you entered during experiment setup override any that the user arrives with.
Example 1 – Source fragment
If the Source URL includes a URL fragment, but the Redirect destination doesn’t, the Final URL will contain the fragment from the Source URL.
Example 2 – Redirect fragment
If the Redirect destination includes a URL fragment, the Final URL will contain the fragment from the Redirect destination.
Example 3 – Fragment conflict
If the Source URL and Redirect destination both include URL fragments, the fragment in the Redirect destination overrides the Source URL fragment and is included in the Final URL.
Relative paths in redirect destinations
If the Redirect destination is a relative path, the Final URL is resolved using the same rules that a web browser uses to resolve a relative URL.
Example 1 – Trailing slash
If the Source URL ends with a trailing slash ("
/"), the relative path in the Redirect destination is appended to the end of the Source URL.
Example 2 – No trailing slash
If the Source URL doesn't end with a trailing slash ("
/"), the path component after the last slash is removed and the relative path in the Redirect destination is appended after the last slash.
Example 3 – Parent directory references
Parent directory references (e.g.: "
../") in relative path are resolved similar to how paths are resolved.
If a website supports URLs with and without a trailing slash (without performing a server side redirect), use a full URL as the Redirect destination. A relative URL will generate a 404 error.
Trimming redirect destinations
When parameters don't conflict, the Final URL includes all of them. When a Final URL exceeds 2048 characters, the "
utm_referrer" parameter is removed.
If a user arrives with conflicting parameters or fragments (see above), all parameters entered during experiment setup override any that the user arrives with.
Example 1 – No conflict
Example 2 – Simple override
Example 3 – Absolute path and partial query override
Example 4 – Relative path and query override
Example 5 – Relative path and no overlap
utm_referrerparameter will be removed.
The Objectives tab
Configure your experiment objectives on the Objectives tab:
- Select a Google Analytics view.
- Select a Primary Objective.
- (Optional) Click + ADD AN OBJECTIVE to add an objective. Optimize users can use up to three pre-selected objectives per experiment and see data for those objectives in Optimize reports. Optimize 360 customers can select additional objectives and view additional goals.
- Add a description and hypothesis.
- Click SAVE.
The Targeting tab
Configure who you wish to target on the Targeting tab:
Who to target
The Who section of the Targeting tab is used to select the visitors to whom you wish to target your variant. Enter a numeric value (in tenths of a percent) or use the slider to specify the percentage of your visitors to include in your experiment.
Edit variant weights
All variants are weighted equally by default in Optimize. A visitor who is included in your experiment has an equal chance of seeing any of your variants. If you want more (or less) traffic to go a specific variant, you can adjust the Weighting of visitors to target.
To edit the weights of your variants:
- Click EDIT, next to the weight distribution bar.
- Enter values for each variant as a percentage (up to one decimal place).
- Click DONE.
Click RESET TO EQUAL to rebalance the weighting equally among your variants.
All of your variant weights must total 100%. If they don’t, you’ll see a red warning message. Simply adjust the weights so that they total 100%, or click FIX IT, which will adjust your current values to total 100%.
When to target
The When section of the Targeting tab determines where the experiment is shown. When is evaluated each time a user visits the experiment page. Use the rules to set where your experiment is seen. To create a targeting rule, click AND, then select a targeting rule type.
Check your rule
Optimize URL targeting includes a convenient condition checker. It allows you to enter a URL to verify whether the condition(s) above it will apply to visitors to that URL. Enter a full URL (copied from your browser’s location bar) in the Enter URL field then click ADD. If the condition you created above applies to the URL, you’ll see a green checkmark next to it. If the condition won’t apply to the URL, you’ll see a red circle with a line through it.
In the example below, notice how the condition won’t apply to visitors of this SSL page (https://) because the match type is set to “equals.”
To ensure that a condition applies to visitors of your regular website (http://) and your SSL website (https://) simply use the “or…” section of the condition builder to add a second URL for your SSL website. Then the condition will apply (green checkmark) to visitors of both URLs.
Optimize includes the following targeting rule types, which you can read more about in the following articles:
- URL targeting
- Analytics Audience targeting
- Behavior targeting
- Geo targeting
- Technology targeting
- First-party cookie targeting
- Query parameter targeting
- Data layer variable targeting
Read more about Optimize targeting.
Start your experiment
Click START EXPERIMENT. When the Status field says Running, your first experiment is running live on the web. Most updates happen within a minute.
How long should your experiment run?
Keep an experiment running until at least one of these conditions has been met:
- Two weeks have passed, to account for cyclical nature of web traffic during the week.
- At least one variant has a 95% probability to beat baseline.
To monitor a running experiment or see the results of a concluded experiment, click the Reporting tab at the top of the experiment detail page. The report is broken down into a series of cards that contain data about your experiment, including its status and how your variants perform against your objectives.
In addition to the reports included in Optimize, you can also see Optimize reports in Analytics. Sign in to Analytics, select the Reporting tab, then elect Behavior > Experiments in the report navigation.
Define a canonical URL
If you create redirect tests to experiment with multiple versions of a given page, we recommend that you define a canonical URL for your variants. This ensures that your redirect page variants won’t have an impact on your original page’s SEO rankings.
Indicate your preferred URL by adding a
<LINK> element with the attribute
rel="canonical" to the
<HEAD> of your redirect variant pages. To learn more about canonical URLs, read Use canonical URLs in the Search Console help center.
Troubleshoot redirect experiments
Final URL changes
If your URL targeting rules aren't identical to the Page URL, the Source URL may not be the same as the Page URL you entered. The Page URL is used to generate a fully-resolved Final URL where the redirect experiment is applied.
If you aren't receiving experiment sessions after the page is redirected, here are some things to check in Chrome DevTools:
Step 1 – Determine if the page is redirecting properly:
- Open Chrome DevTools.
- Click on the Network tab.
- Check the box next to Preserve log.
- Enter the URL of the redirect experiment in the address bar and load it.
- Is the page redirected?
- Yes, the page is redirected – Continue to step 2.
- No, the page is not redirected – Check your targeting rules.
Step 2 – Check if the "
utm_expid" parameter is being sent with the collect URL:
- Open Chrome DevTools.
- Search for "
- Does the Redirect destination contain the "
- Yes – Verify that Google Analytics tracking is set up correctly on the Redirect destination.
- No – Use Chrome DevTools > Network to:
- Look for server-side redirects that clear the query parameters.
- Check the preserved Network log for conflicts with other redirects.
Learn more about Chrome DevTools.