
Fixing Google Analytics for Ghostery - lispython
http://ejohn.org/blog/fixing-google-analytics-for-ghostery/
======
thezilch
I'm not convinced the defined _track_ function is fixing what's described. If
following Google's instruction for "installing" _ga.js_ [0], there shouldn't
be any sites breaking that block _ga.js_ from loading. That is, Google
suggests _var _gaq = _gaq || [];_ at the start of the script installation. If
_ga.js_ never loads, __gaq_ is still an array and can be pushed onto to your
heart's content. If you're concerned with an ever growing array of garbage,
the suggestion in the comments is great:

    
    
      __gaq = __gaq || {push: function(){return 0}}
    

[0]
[https://developers.google.com/analytics/devguides/collection...](https://developers.google.com/analytics/devguides/collection/gajs/asyncTracking)

~~~
jeresig
If that's the case then there are a lot of sites that are willfully ignoring
the correct snippet. Perhaps this was something new that they added recently -
or perhaps there's a frequently-incorrect snippet that's copied?

~~~
yahelc
No, it's not particular new or regularly misimplemented.

It's usually implementing cross-domain tracking that breaks things, not
regular use of GA, because it does `return false` in an onclick handler.

I have some fixes for that here: <https://github.com/yahelc/GA-Better-
Crossdomain-Tracking>

~~~
jeresig
The issue you outline is tangential (but still important). The issues I'm
seeing are actual exceptions occurring where sites are missing the reference
to the GA object, not issues with _link tracking and redirects.

~~~
yahelc
Can you provide live examples? `_gaq.push([]);` shouldn't result in any errors
with Ghostery. I'm curious as to what's happening.

------
gav
I see this more frequently, sites are adding dependencies on third-party
Javascript for tracking, and when they are unresponsive (or blocked with
something like Ghostery) the site's functionality breaks.

This is especially worrying for e-commerce sites, you don't want to prevent
people adding things to the cart and losing orders.

~~~
jakub_g
I've seen that a couple of months ago on the page of a big airline. Since I
had google-analytics.com domain blocked in HOSTS, it took me a while to
realize the issue. However it was the only time it happened to me in many
years (other than deliberate "please disable adblock to see the page"). Very
soon they redesigned the whole page and now it works fine.

~~~
graue
Was that United Airlines? A few months ago their reservation site broke for me
with AdBlock/Ghostery. I just used a different browser entirely, but in
retrospect I suspect it may have been Ghostery's fault.

~~~
jakub_g
Nope, it was LOT (national Polish carrier). Not that big as United ;) but
significant in central Europe.

------
shabble
I was poking around at NoScript surrogates for GA the other day, I reformatted
the code they're using in a comment here[1]

Seems to be using the special (to FF, at least) __noSuchMethod__ property[2]
to catch all calls to the GA object.

[1] <https://news.ycombinator.com/item?id=5182359>

[2] [https://developer.mozilla.org/en-
US/docs/JavaScript/Referenc...](https://developer.mozilla.org/en-
US/docs/JavaScript/Reference/Global_Objects/Object/noSuchMethod)

------
ahmednadar
I have not been so fan of most of google work. I do have Gmail account, but
that's it. In the past I used use other services such as, search, websites,
doc, Google+, ... but not any more. Even Chrome, I use it for testing and
nothing else.

Few years back, Chrome has launched what is been described as Evil EUlA
[<https://duckduckgo.com/?q=google+chrome+evil+eula>] because of what the EULA
at that time contained, as fellowing:

11.1 You retain copyright and any other rights that you already hold in
Content that you submit, post or display on or through the Services. By
submitting, posting or displaying the content, you give Google a perpetual,
irrevocable, worldwide, royalty-free and non-exclusive licence to reproduce,
adapt, modify, translate, publish, publicly perform, publicly display and
distribute any Content that you submit, post or display on or through the
Services. This licence is for the sole purpose of enabling Google to display,
distribute and promote the Services and may be revoked for certain Services as
defined in the Additional Terms of those Services.

Now its been changed: 11.1 You retain copyright and any other rights that you
already hold in Content that you submit, post or display on or through the
Services.

Although they clean their evil mistake but i never used Chrome, i lost respect
for them.

As its clear Google search engine is the best even after Bing attempts. But
still i don't trust them, I see they know more about me as user while using
their search. I did not need that much time to find out they do collect data,
track every thing I search for. Recently I ran into
[<http://www.duckduckgo.com>] where they set them self different from Google
as "We believe in better search and not tracking." Then i said bye bye google
search.

I have ghostery installed in Firefox and I love it. Basically I block any
script for Analytics, tracking, privacy and advertising. Check out what
AdSense do behind the scene: [<http://www.ghostery.com/apps/google_adsense>]

Data Collected: Anonymous (Ad Views, Analytics, Browser Information, Cookie
Data , Date/Time, Demographic Data, Hardware/Software Type, Interaction Data ,
Page Views , Serving Domains) Pseudonymous (IP Address (EU PII), Search
History, Location Based Data, Device ID (EU PII)) PII (Phone Number)

Data Sharing: Anonymous data is shared with 3rd parties.

As you see while you are searching your info (which google got them for free,
because you trust them or you don't know) is been sold for third parties.

I want to feel safe and not been watched for what I browse and search online.
That's why I like my new trust search engine [<http://www.duckduckgo.com>]

~~~
mehrzad
StartPage.com is nice too. Others here, including me, do not like what Google
does much of the time either. But I do respect Go, Android, and Gmail. The
other stuff, not as much.

------
apaprocki
One thing that you need to keep in mind -- if you back-off from CDN loading to
loading a local copy, you'll almost never be testing that scenario so be
careful that a massive influx of local requests in a CDN-is-down scenario
doesn't melt things. It brings up a broader topic of reliability testing..
every one of these branches inserted into the code creates another point at
which performance/load metrics change. Testing all the various combinations
can be difficult.

~~~
LaGrange
Actually, a cool ghostery-like expansion would be replacing CDN links with
things stored inside the extension. This would both save some web requests,
and let me completely ignore google's CDN in case I feel particularly
paranoid.

------
OGinparadise
AFAIK, no site breaks, even if you block them totally via hosts or Ghostery.

~~~
cheald
Until someone makes a call to window.gaq which doesn't exist because you've
blocked GA, which causes their JS to bail out.

