Multi Homed Domain Tracking - Part II

Another challenge when tagging multi homed domain is to correctly set the first party cookie domain in the WebTrends base tag.

Unless the number of domains is limited, and you feel like creating a distinct tag for each domain (which might as well imply bigger implementation effort…), there is a small code which can do the work needed automatically.

It will simply retrieve the host name from the browsers address bar and reduce it to it’s most generic form, e.g. “.domain.tld”.

The JavaScript code snippet can be placed either directly at the end of the wtinit.js file or as inline script in the HTML document between the inclusions of wtinit.js and wtbase.js. If any other place has to be considered, it MUST be after the definition of the dcsInit object and before the call to dcsTag().

The code is the following:

var parts = document.domain.split(".");
var fpcdom = "";
if (parts.length >= 2) {
  var last = parts.length-1;
  fpcdom = "." + parts[last-1] + “
." + parts[last];
}
dcsInit.fpcdom = fpcdom;

Please be aware that this solution still sets a new first party cookie for each domain, so you still rely on the third party cookie to propagate the visitor’s ID accross the domains. However, the first party cookie will be the same for all hosts of the same domain.

Hope this comes in handy for someone!

VN:F [1.3.2_665]
Rating: 5.0/5 (1 vote cast)

Leave a Reply


SiteSensor Browser Pedia Collector