Isrg KB
The Best Way to Gain Knowledge

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

Setting Google Analytics / Tags Cookies only for Root Domain

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:

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.