Hacker News new | ask | show | jobs
by tkazec 3283 days ago
Documented, including the official unminified source, in Google's analytics.js reference: https://developers.google.com/analytics/devguides/collection...
1 comments

Would be nice if they included what variable names they use inside google instead of just i s o g r a m.
They explain what the variables mean in the function header block;

   * @param {Window}        i The global context object.
   * @param {HTMLDocument}  s The DOM document object.
   * @param {string}        o Must be 'script'.
   * @param {string}        g Protocol relative URL of the analytics.js script.
   * @param {string}        r Global name of analytics object. Defaults to 'ga'.
   * @param {HTMLElement}   a Async script tag.
   * @param {HTMLElement}   m First script tag in document.
It might be easier to read the code if they used different names, but any good refactoring tool will replace them with your own names without any problems.
I've noticed several minified JavaScripts that have the variables spell words like the i s o g r a m here. Haven't bookmarked any so I can't find an immediate example. I thought it was just a curiosity, but I think the frequency is increasing. I wonder why. Just for giggles? Or is there any particular reason?
kanyewest.com replaces the letters with "k,a,n,y,e"

    !function(k,a,n,y,e){k.GoogleAnalyticsObject=n;k[n]||(k[n]=function(){
    (k[n].q=k[n].q||[]).push(arguments)});k[n].l=+new Date;y=a.createElement('script');
    e=a.scripts[0];y.src='//www.google-analytics.com/analytics.js';
    e.parentNode.insertBefore(y,e)}(window,document,'ga');

    ga('create', 'UA-34495711-11', 'auto');
    ga('send', 'pageview');
that's hilarious, I wonder who makes/manages celebrity sites like that.
Lane Goldberg in this case.

http://www.builtbylane.com/

Using 1-character variable names saves a small amount of network bandwidth on a massive scale (for every site that uses Google Analytics). You then might as well make the 1-character variable names spell out a word, and that word has to be an "isogram" in order to provide unique variable names.
Here is an example for you:

   (function(h,o,t,j,a,r){
        h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
        h._hjSettings={hjid:1,hjsv:5};
        a=o.getElementsByTagName('head')[0];
        r=o.createElement('script');r.async=1;
        r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
        a.appendChild(r);
    })(window,document,'//static.hotjar.com/c/hotjar-','.js?sv=');
https://docs.hotjar.com/v1.0/docs/understanding-the-tracking...

I believe that Google set a trend, 'HotJar' is a newbie on the block. If anyone can find an example that predates 'urchin.js' (or wherever this started) please share!

I don't know where it started for software, but I can give you an example that predates the web.

In the 80s and early 90s my mother was an interior designer at a high end furniture store. There were no prices on the floor models because most things could be customized (fabric, arm shape, wood, etc) before delivery. However there was a base price that the designer could use to (I guess) keep people within their budget.

They used a ten-letter isogram to print the base price covertly on the furniture labels so that associates could figure it out without going to the back office and looking it up in the computer.

The last word I remember them using was Cumberland. C=0, d=9. So if the base price for a dining room table was $15,840 the tag would have urnec written on it somewhere.

Used car dealers do that. There's usually an alphanumeric that tells the salesperson how much they paid for the car and some other stuff.
that's the kinds of insightful comments I come here for. Side note, I remember in a gift / greeting card shop growing up, everything had long numbers printed on a little sticker on the back, turns out the price was just the last 4 numbers (divided by 1000).
Increased FUD compared to using the plain alphabet maybe?
More in the spirit of an easter egg than FUD, I think.
Who says there are different variable names used inside Google? This is a single-function code snippet that is entirely public.