7.2.12

Quick parse_url

Let's say you have an insane URL like a Google Analytics beacon:
var url = 'http://www.google-analytics.com/__utm.gif?utmwv=5.2.4&utms=23&utmn=353317006&utmhn=www.something.something.com&utmt=event&utme=5(monetization_partner*buy_amazon*%2Fseries%2FThe_Millennium_Trilogy_Stieg_Larsson)(1)8(user_type*logged_in)9(119*true)11(1*2)&utmcs=UTF-8&utmsr=2560x1440&utmvp=1103x767&utmsc=24-bit&utmul=en-us&utmje=1&utmfl=10.3%20r183&utmdt=The%20Millennium%20Trilogy%20-%20Small%20Demons&utmhid=1278954452&utmr=0&utmp=%2Fseries%2FThe_Millennium_Trilogy_Stieg_Larsson&utmac=UA-xxxxxxxx-x&utmcc=__utma%3D76481800.571237505.1328141482.1328580205.1328639116.18%3B%2B__utmz%3D76481900.1328141480.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=6QAAAAAAAAAAAAAQ~';
Now let's say you want to figure it out:
url
  .split(/[?&]/)
  .forEach(function(param){
    console.log( decodeURICompontent(param).replace('=', ': ') ) 
  });
It will look like this:
http://www.google-analytics.com/__utm.gif
utmwv: 5.2.4
utms: 23
utmn: 353317006
utmhn: www.smalldemons.com
utmt: event
utme: 5(monetization_partner*buy_amazon*/series/The_Millennium_Trilogy_Stieg_Larsson)(1)8(user_type*logged_in)9(119*true)11(1*2)
utmcs: UTF-8
utmsr: 2560x1440
utmvp: 1103x767
utmsc: 24-bit
utmul: en-us
utmje: 1
utmfl: 10.3 r183
utmdt: The Millennium Trilogy - Small Demons
utmhid: 1278954452
utmr: 0
utmp: /series/The_Millennium_Trilogy_Stieg_Larsson
utmac: UA-xxxxxxxx-x
utmcc: __utma=76481800.571237505.1328141482.1328580205.1328639116.18;+__utmz=76481900.1328141480.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
utmu: 6QAAAAAAAAAAAAAQ~
So there's that. Enjoy.

Somewhat-related rant

I figure you may want to know what the parameters mean, so here you go. The GIF Request Parameters for Google Analytics (mostly) say:
Tracking code version: 5.2.4
Session counter (not on GA page): 23
Unique GIF id: 353317006
Host Name: www.smalldemons.com
Type of request: event
Extensible vars: 5(<category>*<action>*<label>)(1)8(user_type*logged_in)9(119*true)11(1*2)
Encoding (not on GA page): UTF-8
Screen resolution: 2560x1440
Viewport (not on GA page): 1103x767
Screen color depth: 24-bit
User language: en-us
Java Enabled (not on GA page): 1
Flash version: 10.3 r183
Page title: The Millennium Trilogy - Small Demons
Analytics-AdSense id: 1278954452
Referral URL: 0
Page request: /series/The_Millennium_Trilogy_Stieg_Larsson
Account: UA-xxxxxxxx-x
Cookie: __utma=76481800.571237505.1328141482.1328580205.1328639116.18;+__utmz=76481900.1328141480.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
Crazy sum*: 6QAAAAAAAAAAAAAQ~

*Some fool with a lot more time than me figured it's a bitmap (not an image!) of functions blah blah blah.

Also, if you wonder if this data could be used by third parties to track you, it appears possibly maybe.

I've changed a couple of numbers in this data, just so I don't get a hater commenting on my stupidity. But hey, haters gun' hate anyway.

1 comment:

Gluth said...

Naah, it took just two hours to decode and debug jscript code. It was cool challenge and was fun to do.