Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why domain is hashed in google analytics?

I am building my own library for web analytics reference with Google Analytics, Open Web Analytics.

In Google Analytics, the domain is hashed and this hash is stored in the cookie.

I have found a similar hashing technique in the urchin tracker:

    function(d) {
      if (!d || d == "") return 1;
      var h = 0,
      g = 0;
      for (var i = d.length - 1; i >= 0; i--) {
        var c = parseInt(d.charCodeAt(i));
        h = ((h << 6) & 0xfffffff) + c + (c << 14);
        if ((g = h & 0xfe00000) != 0) h = (h ^ (g >> 21));
      }
      return h;
    }

Is there any specific reason for hashing the domain in google analytics or just for reference?

Any idea is appreciated.

like image 263
karthick Avatar asked Mar 22 '13 06:03

karthick


1 Answers

From the docs for _setAllowHash():

The domain hashing functionality in Google Analytics creates a hash value from your domain, and uses this number to check cookie integrity for visitors.

Note that _setAllowHash has been deprecated -- I don't know if this means Google Analytics no longer uses domain hash for cookie validation or something else...

like image 109
mike Avatar answered Oct 21 '22 05:10

mike