Archive for the ‘Tagging’ Category

Multi Homed Domain Tracking - Part II

Tuesday, March 17th, 2009

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)

Multi Homed Domain Tracking - Part I

Tuesday, March 17th, 2009

In my first post, I would like to share a small code I have implemented to tweak the WebTrends client-side tag to cope with web sites that have multiple domain aliases.

While having multiple domain aliases for the same web site might jeopardize your ranking in search engine indexes, the problem on the WebTrends reporting is that the same page will be split over several domains and audience has to be consolidated manually.

In order to correct this, I did the following:

  1. Add a parameter in the dcsInit object in the wtinit.js file:

    function DcsInit(){
      ...
      this.repdom = "www.unique.com"; // reported domain will be forced to this host, no matter the real domain
      ...
    }
  2. Then go to the dcsVar() function in the file wtbase.js and add the following code

    if (dcsInit.repdom != ""){
      DCS.dcssip=dcsInit.repdom;
    }

    right after the line

    DCS.dcssip=window.location.hostname;

  3. Done.

This will force the DCS.dcssip parameter to the host you specified in the variable repdom (reported domain) and you will therefore have always the same domain in your reports.

This code is based on the wtinit.js/wtbase.js version of the base tag. However, the same logic should be applicable to previous/later versions.

Voilà!

VN:F [1.3.2_665]
Rating: 3.0/5 (2 votes cast)

SiteSensor Browser Pedia Collector