Domain Switcher Plugin

Domain Switcher Plugin for Analytics

The purpose of this plugin is to override first-party cookie (FPC) domain with a correct matching domain from a given possible domains array. By default Analytics is not specifying a domain name when writing first-party cookie and hence the full page domain from the URL is used – which might not be desirable.

For example, visitor landing on checkout.eshop.com by default would have WT_FPC cookie set under .checkout.eshop.com. Therefore the cookie would not be readable under any subdomains of the same website, i.e. www.eshop.com. To avoid this situation, the plugin can be configured with an array of one or more desirable domains, i.e. domains: ['eshop.com'], which would make Analytics write cookie under top-level domain and readable across the site – no matter where visitor lands.

How it works

  • On initialization the plugin checks if it is enabled and if there are domains available in the domains array.
  • It goes through the list of provided domains comparing with the domain of current page (URL).
  • If a submatch is found, FPC domain is set to the matching domain from the domains array.

Plugin configuration

Plugin has a few configuration settings that can be set via ACS tag config:

Param name Default value Purpose
enable true Enable plugin functionality
domains [] Array of domains

For example:

...
"wt-plugins" : {
    "ds" : {
        "enable": true,
        "domains":["webtrends.com", "webtrends.co.uk"]
    },
    ...
    ,
    "anotherPlugin" : {...}
}