- Use a query parameter, aka the "force parameter," to preview a specific variation of an experiment in Optimizely Classic
- Use additional query parameters to:
- enable tracking when using the force parameter (which disables tracking by default)
- create a JavaScript log in the browser console
- disable Optimizely from running on a page
Optimizely lets you use URL parameters to force a specific variation to appear. You can use these parameters to test variations in an experiment and share them with collaborators.
They help you:
-
QA variations outside of the Editor
-
Check event tracking in a variation
-
Create a JavaScript log
-
Disable Optimizely code on a page
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 load and will bypass targeting conditions such as audience targeting and URL targeting.
Parameters at a glance
Here's the basic syntax for force parameters in Optimizely.
Force a variation in an A/B test |
For example, see Variation "1" of Experiment "1243567" with the parameter: http://www.atticandbutton.us/?optimizely_x1234567=1 |
Force a variation in a multivariate test (MVT) |
For example, see Variation "1" of Section "1," the Variation "0" (original) of Section "2," and Variation "2" of Section "3" in Experiment "1234567" with the parameter: http://www.atticandbutton.us/?optimizely_x1234567=1_0_2
|
Enable tracking while using the force parameter |
For example: http://www.atticandbutton.us/?optimizely_force_tracking=true |
Create a JavaScript log in the browser console |
For example: http://www.atticandbutton.us/?optimizely_log=true |
Disable Optimizely from running on the page |
For example: http://www.atticandbutton.us/?optimizely_disable=true |
The optimizely_x
parameter disables tracking. If you use this parameter, you won't see any events firing in the network tab of your browser console. To track events, use optimizely_force_tracking=true
.
Requirements
In Optimizely Classic, you can force a variation on any page that includes the snippet or in Preview mode (if the snippet isn't present).
Here's a short video to explain:
This is the basic syntax of the query parameter:
?optimizely_xEXPERIMENTID=VARIATIONINDEX
For example, for a site (http://atticandbutton.us/) with Variation "1" of Experiment "1234567," this would be: http: //atticandbutton.us/?optimizely_x1234567=1:
Here's where to find the Experiment and Variation IDs:
-
Navigate to the Editor.
-
Then, go to Options > Diagnostic Report.
-
You'll find the Experiment ID in the report. It's also in the URL of the experiment in the Editor: look for the ten-digit number.
-
The Variation Index identifies the variation you want to run. "0" is the original, "1" is the Variation 1, "2" is Variation 2, etc.
By default, force parameters are disabled in Optimizely to help protect your privacy. To use them, uncheck the Disable the force variation parameter box. Here's how:
-
Navigate to the Home page.
-
Select the Settings tab > Privacy. Uncheck Disable the force variation parameter.
The force parameter is one method in the Pre-Launch Checklist. After you QA with force parameters, use a test cookie to QA in a live environment. Test cookie audience conditions adhere to all targeting conditions -- including audience and URL targeting -- while force parameters bypass these conditions.
Running experiments
If you use the query parameter in a running experiment, the variation you force will display and you'll be cookied into that variation. If you were previously cookied in a different variation, the force parameter will switch the cookie and you'll be bucketed into the forced variation.
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)