Menu

Digital Pradesh

Government notices, courts and money – explained from the source

How to Disable Google Analytics or Google Tags Cookies for Sub Domains?

This article was published on 2 May 2018 and may be out of date.

google analytics

Google Analytics free and premium web and app analytics tool for the developers and webmasters to collect the analytical data, track users’ activities and real-time analytical report. More than a half of the percent of the websites on the Internet are using Google Analytics (GA) and the reason is simple, Ease of implementation, Ease of Usability, Reliability and Measurability — no doubt it comes with countless advantages, but has few disadvantages.

Talking about the disadvantages or the cons of the Google Analytics it include:

  1. Performance issues,
  2. Accuracy is doubtful and
  3. Data breach etc.

As soon as your integrate Google Analytics on your website or with your app, you’ve to agree with the Terms of Conditions of Google, Data collection and Cookies Policies. Google Analytics may collect sensitive data from your website which varies from the collection of the personal data of your visitors to the contents of your website even if it is protected.

Does Integrating Google Analytics degrades Performance?

Adding any addition stuffs on your website does impact the performance of your site. There are two methods to integrate Google Analytics on your website, first one is by placing the JavaScript GA Tracking snippet and the other method is by adding the JavaScript Google Tag snippet combined with iFrame for noScript functionality. Though, Google Analytics uses Async-method to load the JavaScript files which improves the page loading, but still it does utilises the resources of the browser.

The cookies used by Google Analytics also impact the performance of your website since the GA uses Global cookies which means, cookies generated by GA will be for your-root.com domain and the subdomains.your-root-domain.com where it is recommended to disable the Cookies for sub-domains especially, when you are serving static contains from your subdomain.example.com

Thanks to Google Tags, and rights to alter the tracking code you can set the cookies only for your root domain using following snippet:

<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'YOUR-TRACE-CODE', {
  'cookie_name': 'gaCookie',
  'cookie_domain': 'www.YOUR-DOMAIN.com',
  'cookie_expires': 2419200
});

Is Google Analytics Accurate?

Certainly, not. Google Analytics is not accurate and there is reason behind it, the first reason is Google Analytics uses JavaScript to trace the user events like page load and clicks etc. where the browsers with JavaScript disabled may not be tracked by Google Analytics. 

The other reason is the Privacy Policy where the Google cannot disclose sensitive information about the visitors on the website, for example — Google display “(not provided)” in the query or the keyword used to search for your website.

Is there any chances of Google Analytics Data breach?

Well, no one can predict that, but still it is riskful especially after the Cambridge Analytica data breach.

Updates and corrections

No corrections or updates have been noted for this article since publication on 2 May 2018.

Found an error? Report it with the article link and your evidence. Read our editorial standards.

Topics

About the author

Isrg Rajan

Isrg Rajan is the founder and editor of Digital Pradesh (isrgrajan.com), which he started at the end of 2011 and has published since 2012. He edits the site, sets its editorial standards and is responsible for the articles published under this name.