Javascript libraries that conflict with Google Analytics

Google Analytics custom implementations are fragile. This may be hard to hear but it’s true. When you use some custom functions of the ga.js library they can affect the format of the Google Analytics cookies (__utma, __utmb, __utmz, ..), if another implementation on the same page tries to read or write to those cookies and it’s configurations are different, chances are that the second one will delete the old cookie and create a new one. When it does so, you lose the reference to the unique visitor and the current session. If you have multiple conflicting trackers on the same site, chances are that at each pageview the cookies are reset spawning a new visitor and a new visit with a (direct)/(none) source/medium. No one wants that.

Google doesn’t recommend the usage of multiple trackers on the same page for that reason. If you are not an expert on the subject it’s very easy to shoot yourself on the foot. And even the experts are messing things out every now and then.

But recently a couple of popular Javascript libraries out there started to include GA trackers on your site. The primary intent is to monitor the usage of their libraries. The problem is that these libraries inject a Google Analytics tracker on your site and are not careful about it. These GA implementations run on your site and share the same cookie as your implementation. They tend to use default configurations for their trackers and if you also have a default configuration you should be safe. But if you were smart enough to customize your GA implementation chances are that yours and the library implementation will be conflicting and things will get ugly.

Right now we’re aware of only 3 libraries that do this:

TypeKit gives you the option to disable this functionality under the TypeKit Editor > Kit Settings. But it’s on by default.

It’s highly recommended that you disable this tracking.

Add to Any currently doesn’t support disabling the Google Analytics code injection. So the only available workaround is to stop using it and move to a similar library, that are a couple out there.

ShareThis allows you to opt out tracking on their privacy policy.

Privacy Implications

I only talked about the technical issues that may arise for these libraries. But you have to keep in mind that while they are gathering data to “monitor usage of their libraries” they are also receiving all your website usage data. Add to Any even have the following statement on their Terms of Service:

Data Rights
In order to provide certain Services, you must allow us to use raw data related to the use and distribution of Your Content (“Data”) that will be collected as part of the Services. You hereby grant AddToAny a non-exclusive, perpetual, worldwide and irrevocable right and license to utilize the Data to track, extract, compile, synthesize, aggregate, and analyze such Data, including, but not limited to, the creation of anonymous and promotional tracking data (“Tracking Data”). We reserve the right to use, reproduce, distribute and display Tracking Data, in our sole discretion.

If you know about any other tool or library that is injecting Google Analytics trackers please let us know on the comments, we’ll update this post and will try to contact the library authors.

Eduardo Cereto

Share
Published by
Eduardo Cereto

Recent Posts

Google Delays Third-Party Cookie Deprecation to 2025

Google announced on April 23 that it will again delay third-party cookie deprecation (3PCD) in…

6 days ago

Understanding Funnel Reports in GA4

Funnel reports have long been one of the most actionable reports in a marketing analyst’s…

1 week ago

GA4 Monetization Reports: An Overview

GA4’s Monetization reports provide organizations with simple but actionable views into the revenue-generating aspects of…

2 weeks ago

This website uses cookies.