cookieDomainPeriods
AppMeasurement determines its cookie location by looking at the domain and domain suffix. For domains like example.com
, AppMeasurement sets cookies in the correct location. However, for other domains like example.co.uk
, AppMeasurement can mistakenly set cookies on co.uk
. Most browsers reject cookies set on this invalid domain, causing issues with visitor identification.
The cookieDomainPeriods
variable helps AppMeasurement determine where Analytics cookies are set by calling out that the domain suffix has an extra period in it. This variable allows AppMeasurement to accommodate the extra period in the domain suffix and set cookies in the right location.
- For domains like
example.com
orwww.example.com
, this variable does not need to be set. If needed, you can set this variable to"2"
. - For domains like
example.co.uk
orwww.example.co.jp
, set this variable to"3"
.
cookieDomainPeriods
on the example URL store.toys.example.com
. AppMeasurement by default recognizes that cookies should be stored on example.com
, even on URLs with many subdomains.Domain periods using the Web SDK
The Web SDK can determine the correct cookie storage domain without this variable.
Domain Periods using the Adobe Analytics extension
Domain Periods is a field under the Cookies accordion when configuring the Adobe Analytics extension.
- Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.
- Click the desired tag property.
- Go to the Extensions tab, then click the Configure button under Adobe Analytics.
- Expand the Cookies accordion, which reveals the Domain Periods field.
Set this field to 3
only on domains containing a period in its suffix. Otherwise this field can be left blank.
s.cookieDomainPeriods in AppMeasurement and the Analytics extension custom code editor
The cookieDomainPeriods
variable is a string that is typically set to "3"
, only on domains that contain a period in its suffix. Its default value is "2"
, which accommodates most domains.
// Manually set cookieDomainPeriods for domains with a period in its suffix, such as www.example.co.uk
s.cookieDomainPeriods = "3";
// Detect if a URL has a domain suffix with an extra period, and set s.cookieDomainPeriods automatically
document.URL.indexOf(".co.") > 0 ? s.cookieDomainPeriods = "3" : s.cookieDomainPeriods = "2";