Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Opt Out

Describes how to opt out of (or opt in) an experiment.

Opting Out

If you need to disable Optimizely Performance Edge on a page, but you are unable to remove the Optimizely Performance Edge tag, the Edge Decider will obey the optimizelyOptOut cookie on your cookie domain. Make sure that you set the optimizelyOptOut cookie prior to your Optimizely Performance Edge tag so that the cookie gets sent to the Edge Decider.

What does opting out mean?

  • The user will not get bucketed into an experiment.
  • The user will not see any variation changes.
  • Project JS will not run on the page.
  • The user will not be tracked.
  • The user will remain opted out (i.e., all of the above will apply) anywhere that Optimizely Performance Edge is running on the same domain.

You can also set the optimizelyOptOut cookie with the optimizely_opt_out=true query parameter, like so: www.yoursite.com/?optimizely_opt_out=true.

Code sample

<!-- 1. Set the opt out cookie on your cookie domain -->
<script>
  var maxAge = 6 * 30 * 24 * 60 * 60; // 6 months
  var yourCookieDomain = '.example.optimizely.com';
  document.cookie = `optimizelyOptOut=true; path=/; domain=${yourCookieDomain}; max-age=${maxAge}`;  
</script>

<!-- 2. Add the Performance Edge script tag after the cookie-setting logic -->
<script src="/edge-client/v1/<account_id>/<project_id>"></script>

Opt In

To opt in, delete the optimizelyOptOut cookie on the cookie domain prior to the Performance Edge tag.