dcsimg

How to set the cookie name by domain

Products

Webtrends Analytics 8.x
Webtrends Analytics 9.x

Cause

You want to accomplish one of the following goals:

1.Have one cookie for all subdomains you are tracking so you can combine visitor measures for SEO, campaign tracking etc.

2. Have separate cookies for each subdomain so you can track visitor actions separately.

3. Have the tag automatically set the cookie name on any domain so that you can use one set of tag code to deploy anywhere regardless of the domain.

Resolution

The cookie name has to match the main domain to set a first party cookie.If it does not match most browsers will not write the cookie, adversely affecting your ability to track repeat visitor actions. How you name the cookie affects whether a cookie covers all sub-domains or just a specific sub-domain.

1. One cookie for all subdomains on the same main domain:

If generating a tag using tagbuilder.webtrends.com set “The site domain you want to track:” to the domain.For example, if your site includes one.mydomain.com and other.mydomain.com enter:

mydomain.com

Under Additional Option – Visitor Tracking make sure that the “Track visitors to the primary domain and each subdomain separately” box is NOT checked.

In the webtrends.js code generated by Tagbuilder this will create the variable line:

this.fpcdom=”.mydomain.com”;

(Older tag code may use the variable gFpcDom but the value format is the same)

This tag will work on any subdomain of the one listed in the code and only use one cookie.To change domains you can change the variable in the tag code or generate a new tag on Tagbuilder.Do not use code with a domain variable that does not match the page domain.

2.Separate cookies for each domain.

If generating a tag using tagbuilder.webtrends.com set “The site domain you want to track:” to the domain in question.For example, if the site includes one.mydomain.com and other.mydomain.com enter:

mydomain.com

Under Additional Option – Visitor Tracking make sure that the “Track visitors to the primary domain and each sub-domain separately” box is checked.

In the webtrends.js code generated by Tagbuilder this will create the variable line:

this.fpcdom=””;

(Older tag code may use the variable gFpcDom but the value format is the same)

Empty quotes in the fpcdom value will have the tag pick up the full domain from the browser instead of the tag code.It will write a separate cookie for each full domain name.

3.Automatically set the cookie name for any domain.

Create the same as #2 above.The domain entered in the “The site domain you want to track:” field doesn’t matter as long as you have the “Track visitors to the primary domain and each sub-domain separately” box checked. The generated code, shown below, will work on any site:

this.fpcdom=””;