- Use a "test cookie" or query parameter to browse an experiment or campaign as if it's live
- Set a test cookie on your page, then target based on it
- Show a live experiment or campaign to an internal audience
When you QA, it's often useful to be able to start an experiment or campaign live on your site but allow only internal employees to see it.
Setting a test cookie allows you to show a running campaign or experiment to a set of internal stakeholders. You'll create a bookmarklet in the browser that sets the cookie. Then, use audience conditions to target the cookie. Visitors who have the test cookie will be able to navigate across multiple pages, and fire events in the live experiment or campaign.
In Optimizely Testing, the test cookie is a key tool in the Pre-Launch Checklist for QA.
In Optimizely Personalization, the test cookie will help you share running campaigns. Use the Preview tool to check that your campaign looks and works the way you'd like, before you publish. Then, use the test cookie to share the live campaign with internal holders for QA.
Read on to learn how to set up and target a test cookie.
Cookie targeting isn't available to all plan types. If you don’t see this feature in your Optimizely account, please refer to our package matrices for Optimizely X and Optimizely Classic. You can also share the campaign with internal holders for QA by using the Share Link, Cross-Browser Testing, and Force Query Parameters.
Set a test cookie
You'll set the test cookie in every browser used to QA with this method.
First, open a browser in Chrome and create a bookmark on any page.
Click the bookmark to change the name to "Set test cookie." Select Done to confirm.
In the Chrome toolbar, select Bookmarks > Bookmark Manager. Click to edit the bookmark.
Next, navigate to page your site where you'd like to set the test cookie.
Click the bookmark to create a test cookie.
You now have a cookie set on whichever domain you're browsing. The cookie will look something like this:
When you reload the page, you'll eligible to enter experiment or campaigns that target that cookie.
Target the test cookie
Once you've set your test cookie, use an audience condition to target it. Only visitors who have the test cookie will be eligible to enter the experiment or campaign.
First, create a new audience.
In Optimizely Testing:
In the Home page, select an experiment. In the Experiment Details sidebar, scroll to Audiences and click Edit.
Then, select Add a Saved Audience if you'd like to add the cookie to an existing audience. Or, click Create a New Audience.
In Optimizely Personalization:
Navigate to the Experiments dashboard and choose your campaign.
In the Manage Experiments sidebar, click Audiences. Choose Create New Audience.
Then, target the cookie.
Under Conditions, drag Cookie into the Audience Conditions.
Enter the name of the test cookie in the text box (i.e.,
optly_YOURDOMAINNAME_test) set to has any value.
Target a query parameter
If your Optimizely plan doesn't include targeting by cookie, you can use a query parameter instead. This also works well when QAing your experiment on a mobile device.
When you view your page live, you'll have to append the query parameter that you selected. For instance, on Google's homepage, this may look like https://www.google.com?optly_google_test if you use the following query parameter:
Just note that if you use a query parameter instead of a cookie, you'll have to re-add the query parameter to the URL when you browse to another page.
Once you're done, click Apply and then save the experiment.
Run the experiment or campaign
Now that you've set the test cookie, start the experiment or campaign to view it live.
To see the experiment or campaign, you still need to meet all of the targeting conditions. But once you're bucketed into a variation or experience, you can navigate around the site and stay in that variation. You can also test whether your goals are firing correctly.
Remove the test cookie
When you're ready to make the experiment live for other visitors, head back to targeting. Remove the cookie restriction by clicking the red x next to it. Remember to click Apply to save the change to the experiment.