Force behaviors in Optimizely using query parameters

  • Updated
Relevant products:
  • Optimizely Web Experimentation
  • Optimizely Performance Edge
This topic describes how to:
  • Use additional query parameters to:
    • Create a JavaScript log in the browser console
    • Disable Optimizely from running on a page

Force parameters are disabled by default in Optimizely to help protect the privacy of your account.

Optimizely Performance Edge is a lightweight experimentation product that delivers significantly faster performance than previous versions of Optimizely. It does this by relying on a streamlined "microsnippet" which limits the range of available features.

Optimizely Performance Edge and Optimizely Web handle force parameters the same way, so all information contained in this article applies to experiments created with either version of Optimizely.

To use force parameters, follow these steps:

  1. Navigate to Settings ImplementationNote: If you have custom snippets, you will have to edit the custom snippet by clicking on the name then scrolling down to Privacy.

  2. Uncheck the Disable the force variation parameter box. Here's more information about that setting.

  3. If you'd like to force variations for draft or paused experiments to appear, check the Allow anyone to view draft or paused experiments box. Remember, this setting allows anyone to view your draft or paused changes simply by adding optimizely_token=PUBLIC .

  4. Append the query parameter to your site's URL. Below, we show a couple of examples.

  5. Once you're done, return your settings to the default mode. Navigate to Settings > Implementation Settings to check Disable the force variation parameter.

Optimizely lets you use URL parameters to force a specific variation or personalized experience to appear. The parameters let you skip all targeting conditions (like audiences) and force the variation code to execute on the page. Force parameters are best used to check changes that aren't too technical complex or dependent on timing. 

For example, let's say you change the text or an image on your homepage. You can simply append a query parameter to quickly view change without worrying about having to meet the targeting conditions. 

Force variation parameters are also a great way to share variations with key stakeholders.

They help you:

  • QA variations outside of the Editor

  • Create a JavaScript log

  • Disable Optimizely code on a page

  • View draft or paused experiments (with the help of a public token, see below)

Essentially, you add a query parameter to the end of any URL on your site. It tells Optimizely which variation or experience to run when the page loads. You can also force yourself into an audience with the optimizely_x_audiences=audienceId query parameter. For a list of query parameters you can use, please see the table below.

  • Forcing a variation to run will disable all other variations and experiments that are running on the page.

  • Forcing a variation or audience will not force an experiment or Page to activate. You will still need to meet the URL Targeting and Activation conditions.

Parameters at a glance

Here's the basic syntax for force parameters in Optimizely. 

Force a variation or personalized experience from a running, published experiment to display


For example, to see a Variation with the ID "1234567890" in an experiment, you'd use this:

You can force multiple variations across experiments by comma-separating different variation IDs. For example, to see a Variation with the ID "1234567890" from experiment 1, and a Variation with the ID "9876543210" from experiment 2, you'd use this:,9876543210

Note that with Performance Edge, force parameters can only be used on published and running experiments.

Enable tracking while using the force parameter


For example:

Force a variation or personalized experience from a draft or paused experiment to display


For example, to see Variation with ID "1234567890" of a draft experiment, you'd use this:

To use this parameter, you'll need to enable certain Privacy Settings.

Force yourself into a specific audience


For example, if your Audience ID is "1123581220" and you want to view an experiment or campaign as that audience, you'd use this:

You can use a comma-separated list of Audience IDs, such as: optimizely_x_audiences=1123581220,987654321,510203040 (for audiences with these IDs: 1123581220, 987654321, 510203040).

Create a JavaScript log in the browser console


For example:

Disable Optimizely from running on the page


For example:

To find experiment, variation, and audience IDs, navigate to API Names in your experiment or Personalization campaign.

Experiments or campaigns that are running

When you use query parameters in a running experiment, the variation you force will display and your variation mapping will be updated in localStorage. 

If you were previously bucketed in a different variation, the force parameter updates that bucketing. You'll then be persistently bucketed into the new variation.

Experiments or campaigns that are paused or in draft mode

You can use a public token to force variations for draft or paused experiments if you're willing to allow anyone to view draft or paused experiments. You'll need to enable this parameter in your project's privacy settings.

Here's the parameter:


To use the public token, you must check Allow anyone to view draft or paused experiments in the Project Settings. Enable this setting with care. It allows anyone to view your draft or paused changes by appending optimizely_token=PUBLIC to the Preview URL. Disable this setting once you've finished QA.

Alternatively, use the Share Link feature to show draft variations and experiences that haven't been published to team members without exposing these variations or experiences broadly.

Let's imagine your site has the URL If you're running an experiment with the ID "123456" and you'd like to force yourself into variation with ID "1234567890," the URL and parameter will look like this:

http: //

Now let's say you pause your experiment, and you'd like to view variation with ID "2345678901" of the paused experiment. First, you'll enable the public token. Then, view the variation with this URL and query parameter:

http: //

Manual and conditional activation

If you're using manual or conditional activation, here's what you need to know: 

  • Manual activation: the parameter will only activate a running experiment

  • Conditional activation: the parameter only activates the experiment if the activation conditions are met (i.e. the conditional activation code evaluates to true)