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.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With