This topic describes how to:
- Use a "test cookie" or query parameter to browse an experiment or campaign as if it is 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 is 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 will 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 Web Experimentation Testing, the test cookie is a key tool in the Pre-Launch Checklist for QA.
In Optimizely Web 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 would 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.
Set a test cookie
You will 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 the page of your site where you would like to set the test cookie.
Click the bookmark to create a test cookie.
You now have a cookie set on whichever domain you are browsing. The cookie will look something like this:
When you reload the page, you will be eligible to enter an experiment or campaigns that target that cookie.
Target the test cookie
After you have 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.
Navigate to the Experiments dashboard and choose the experiment or campaign.
In the Manage Experiments sidebar, click Audiences.
Click Create New Audience.
Enter a name for the audience.
Drag Cookie from the list of available conditions into the Audience Conditions.
Enter the name of the test cookie,
optly_YOURDOMAINNAME_testin the text box and set to has any value.
Click Save Audience.
Target a query parameter
If your Optimizely Web Experimentation plan does not 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 will 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 will 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 have 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 are 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 are 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.
For more information
For an in-depth tutorial on how to verify that your goals are firing in Optimizely Web Experimentation, check out this article on Troubleshooting: Metrics do not track correctly in Optimizely Web Experimentation.
To learn how to force yourself into a specific variation of your running experiment using query parameters in Optimizely Web Experimentation, check out this article on how to Force behaviors in Optimizely using query parameters.