_u parameter in universal google analytics collect hits

2.8k views Asked by At
1

There are 1 answers

1
Lukas Grebe On BEST ANSWER

It appears to be an analytics of analytics. While analytics.js runs, single bits of a 48 bit long array (managed via function $c and it's prototype) are set.

var vd=new $c;
function J(a){
   vd.set(a)
}

For example bit 48 is set if the Linker Feature is used, bit 42 is set if window.navigator.sendBeacon is used to send a tracking beacon, bit 40 in case of transmission via XMLHttpRequest, bit 31 if a / has to be prepended to an extracted Path.

var e=d.pathname||"";
"/" != e.charAt(0) && ( J(31), e = "/" + e );

8 Groups of 6 Bits are used to build a string out of the 64 Characters [A-z-_] postpended by tilde ~ and transmitted under the _u parameter.

$c.prototype.encode = function(){
  //Group 6 bits to use a 64 Char Alphabet
  for(var tempArr=[], i=0; i < this.bitsArray.length; i++) {
    this.bitsArray[i] && (tempArr[Math.floor(i/6)] = tempArr[n.floor(b/6)] ^ 1 << i%6);
  }

  //Translate from 6 Bit groups to Alphabet
  for(i=0;i<tempArr.length; i++){
    tempArr[i]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(tempArr[i]||0);
  }
  return tempArr.join("")+"~";
};

If i've analysed the _u parameter correctly, decoding this string back to the individual bits would allow Google to identify if the corresponding features were used or points in the code were reached whilst running analytics.js