Create a redirect test

Test page variants that differ significantly from each other.

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:

Prerequisites

Here's a checklist of items that must be completed before creating a redirect test:

  1. Create your web page variant(s) outside of Optimize and have the URLs ready.
  2. Deploy the Optimize snippet and Analytics tracking on your original page.
  3. 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.
  4. 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:

  1. Navigate to your Optimize account.
  2. Click on a container to get to the Experiments page.
  3. Click CREATE EXPERIMENT.
  4. Enter an Experiment name (up to 255 characters).
  5. Enter a fully-resolved Page URL (not a redirect).
  6. Click Redirect test.
  7. Click CREATE.

Create a redirect test dialog box.

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:

  1. Click CREATE VARIANT.
  2. Enter a Variant name (e.g. "Variant 1").
  3. Enter a Redirect destination (e.g. "destination?s3=v3&s1=v3#dest").
  4. Click ADD.

The Optimize Add variant dialog when creating a redirect experiment.

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

http://www.example.com/original?s1=v1&s2=v2

Redirect destination

destination?s3=v3&s1=v3#dest

Final URL

http://www.example.com/destination?s3=v3&s1=v3&s2=v2#dest

Definitions

  • 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.

Source URL

http://example.com/home?s1=v1&s2=v2

Redirect destination

?d1=u1&d2=u2

Final URL

http://example.com/home?d1=u1&d2=u2&s1=v1&s2=v2&utm_expid=<expid>&utm_referrer=<referrer>

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.

Source URL

http://example.com/home?s1=v1&s2=v2&s3=v3

Redirect destination

?s2=u2&s3=u4&d4=u5

Final URL

http://example.com/home?s2=u2&s3=u4&d4=u5&s1=v1&utm_expid=<expid>&utm_referrer=<referrer>

URL fragments in redirect destinations

A URL fragment, or fragment identifier, is the portion of a URL after a hash sign (e.g.: "#source").

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.

Source URL

http://www.example.com/path1#source

Redirect destination

/path2

Final URL

http://www.example.com/path2#source

Example 2 – Redirect fragment

If the Redirect destination includes a URL fragment, the Final URL will contain the fragment from the Redirect destination.

Source URL

http://www.example.com/path1

Redirect destination

/path2#target

Final URL

http://www.example.com/path2#target

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.

Source URL

http://www.example.com/path1#source

Redirect destination

/path2#target

Final URL

http://www.example.com/path2#target

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.

Source URL

http://example.com/path1/

Redirect destination

path2

Final URL

http://www.example.com/path1/path2

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.

Source URL

http://www.example.com/path1

Redirect destination

path2

Final URL

http://www.example.com/path2

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

Source URL

http://www.example.com/path?param1=value1

Redirect destination

?param2=value2#frag1

Final URL

http://www.example.com/path?param2=value2&param1=value1&utm_exp…#frag1

Example 2 – Simple override

Source URL

http://www.example.com/path?param1=value1#frag1

Redirect destination

/newpath?param1=value2#frag2

Final URL

http://www.site.com/newpath?param1=value2&utm_exp…#frag2

Example 3 – Absolute path and partial query override

Source URL

http://www.site.com/path?param1=value1&param3=value3

Redirect destination

/newpath/?param1=value2&param4=value4

Final URL

http://www.site.com/newpath/?param1=value2&param4=value4&param3=value3&utm_exp...

Example 4 – Relative path and query override

Source URL

http://www.site.com/path1/file2?param1=value1#frag1

Redirect destination

file3?param1=value2

Final URL

http://www.site.com/path1/file3?param1=value2&utm_exp…#frag1

Example 5 – Relative path and no overlap

Source URL

http://www.site.com/path1/?param1=value1

Redirect destination

file2?param2=value2

Final URL

http://www.site.com/path1/file2?param2=value2&param1=value1&utm_exp...

If a redirect URL exceeds 2048 characters, the utm_referrer parameter will be removed.

The Objectives tab

Configure your experiment objectives on the Objectives tab:

  1. Select a Google Analytics view.
  2. Select a Primary Objective.
  3. (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.
  4. Add a description and hypothesis.
  5. 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:

  1. Click EDIT, next to the weight distribution bar.
  2. Enter values for each variant as a percentage (up to one decimal place).
  3. 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.

Optimize targeting

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.”

Check your rule to verify that the condition above will apply.

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.

Targeting rules

Optimize includes the following targeting rule types, which you can read more about in the following articles:

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:

  1. Two weeks have passed, to account for cyclical nature of web traffic during the week.
  2. At least one variant has a 95% probability to beat baseline.

Reports

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.

Learn more about Optimize reports.

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.

Chrome DevTools

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:

  1. Open Chrome DevTools.
  2. Click on the Network tab.
  3. Check the box next to Preserve log.
  4. Enter the URL of the redirect experiment in the address bar and load it.
  5. Is the page redirected?
    1. Yes, the page is redirected – Continue to step 2.
    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:

  1. Open Chrome DevTools.
  2. Search for "www.google-analytics.com/collect".
  3. Does the Redirect destination contain the "utm_expid" parameter?
    1. Yes – Verify that Google Analytics tracking is set up correctly on the Redirect destination.
    2. No – Use Chrome DevTools > Network to:
      1. Look for server-side redirects that clear the query parameters.
      2. Check the preserved Network log for conflicts with other redirects.

Learn more about Chrome DevTools.

Was this article helpful?
How can we improve it?