The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
API Reference

Cookie domain

Instruct Optimizely Web Experimentation to set its cookies on a specific subdomain instead of the default domain.

Syntax

window["optimizely"].push(cookieDomain);

Parameters

Parameter and TypeChild AttributeDescription
cookieDomain
CookieDomainObject
N/AAn object with the type field set to cookieDomain. The other fields are the function arguments. Required.
type
string
Child attribute of type CookieDomainObjectThe argument indicating that you are using the cookieExpiration function. Required.
cookieDomain
string
Child attribute of type CookieDomainObjectThe cookie domain.

Example Call

window["optimizely"].push({
  "type": "cookieDomain",
  "cookieDomain": "www.example.com"
});

Description

Instruct Optimizely to set its cookies on a specific subdomain instead of the default domain. You must call "setCookieDomain" prior to loading the Optimizely snippet. By default, Optimizely sets its cookies on the domain to work across subdomains.