How to Prevent Google Analytics from Tracking You

Shanika W.

By Shanika W. . 11 February 2024

Cybersecurity Analyst

Miklos Zoltan

Fact-Checked this

9 Comments

Google Analytics is a free tool by Google that provides robust insights into website visitor performance and statistics.

In this guide you will learn about:

  • Why you should not want Google Analytics to track you
  • Methods to prevent Google Analytics from tracking you

Many businesses integrate Google Analytics into their websites to track visitor statistics and gather valuable web metrics.

However, blocking Google Analytics is more widespread now due to various privacy concerns. Once a person blocks Google Analytics, that person is not being tracked, and nothing is sent to Google Analytics servers.

This article will explain some popular methods out there to prevent Google Analytics from tracking you.

Summary: This article explores Google Analytics and the reasons behind the desire of some individuals to obstruct its tracking capabilities.

It outlines how Google Analytics gathers data on website visitors, offering crucial insights to site owners.

Yet, due to privacy worries, certain users seek ways to avoid being tracked by Google Analytics.

To address this, the article offers various strategies for blocking Google Analytics, such as employing browser extensions, utilizing a firewall or modifying the hosts file, implementing ad-blockers or script blockers, and opting for the Brave browser.

How to Prevent Google Analytics from Tracking You

Why You Should Block Google Analytics from Tracking You

Tracking user behavior is very beneficial for website owners. The collected data can be used for marketing, conversion rate optimization, user experience (UX) improvement, auditing, etc.

In general, Google Analytics will collect at least the following information from a website’s guests.

  • The amount of time visitors spend on the website and on each page
  • What are the searches that led them to the content they viewed
  • The particular actions of visitors when they’re accessing the pages
  • Individual IP addresses of visitors and the browsers they use

All the above information sounds harmless. However, when websites and apps start sharing data, it gets to the point where marketers can get a creepily accurate image of you. For some visitors, this is unnerving, and they may get annoyed with the relentless stream of targeted ads.

On the other hand, the information users provide to websites is their price to get better product recommendations, search results, specific offers, etc. Abstractly, all these help towards a better web experience.

However, if they want to opt-out of tracking, it should be within their ability.

Check out our guide on privacy friendly Google alternatives if you want to switch away completely from Google.

Methods to Block Google Analytics from Tracking You

Below, I’ll show you several methods you can implement to prevent Google Analytics from tracking your browsing and internet activity.

1. Installing Google Analytics Opt-Out extension

Using this official extension is the best way to opt-out of Google Analytics. The main advantage of using the Opt-Out extension is that you can make sure it always works even when Google makes changes to its services.

However, there are also some downsides to this extension. One is that you have to install it on your computer. Installing software to stop other software from tracking your activities is not very productive. The other disadvantage is that this extension can’t stop Google from knowing about the websites you visit. It just blocks sending events to Google Analytics.

The Google Analytics Opt-Out Extension works with all major browsers, including Google Chrome, Firefox, Safari, Internet Explorer, and Opera.

Google Analytics Opt-Out

2. Installing the “Block Yourself from Analytics” Chrome extension

Another simple method to block Google Analytics is using a Chrome extension called “Block Yourself from Analytics.” It restricts Google Analytics from tracking your visits to specific websites when installed. Interestingly, this extension allows you to set a list of domains you don’t want your visits to get tracked.

Below are the steps to install and set up the “Block Yourself from Analytics” Chrome extension.

Step 1: Open Chrome browser

Step 2: Visit this link to find the extension.

Step 3: Click on the blue “Add to Chrome” button and click “Add Extension” in the following popup.

Block Yourself From Google Analytics

Press “Add Extension.”

Block Yourself From Google Analytics Extension

Step 4: Now, you can see an orange icon in your browser’s top right as below.

How to Block Google Analytics From Tracking You - Chrome Extension

Step 5: Now, navigate to the website that you don’t want your visits to get tracked by Google Analytics. Then click on that small orange icon on the browser and click “Block Analytics for this website.”

You can also manually add (without navigating to the website) any website/websites you want or view the list of websites you have blocked by clicking on “Options.” To manually add a website using the “Options” area, enter the URL of the website in the text field at the bottom of the window and click “Add.” In the end, make sure to save all the websites you added before exiting.

Block Yourself From Google Analytics Extension - Options

The main drawback of this method is that it only works with the Chrome browser.

3. Using a firewall to block Google Analytics

If you have a firewall that can block specific IP ranges or domain names, you can block Google Analytics for your entire network. This option also has some downsides, such as IP addresses changing without notice or multiple services using the same IP address. If your firewall can block DNS requests to particular domain names, you can add a rule to block the domain google-analytics.com and www.google-analytics.com to opt-out Google Analytics.

4. Using Hosts file to block Google Analytics

You can also opt out of Google Analytics by assigning the domain name to a different IP address in the host file. The local hosts file is checked to see if the hostname/domain name is assigned a particular IP address before serving a DNS request.

This is similar to blocking the DNS request of Google Analytics, which we discussed earlier. The steps of this method will vary depending on your operating system, but it works with OS like Linux, Windows, and macOS.

Following are the steps to opt-out of Google Analytics for Microsoft Windows. Here, we will assign the domain name of Google Analytics to a non-existing IP address, leading any request to it getting terminated instead of sending it to Google.

Step 1: Run Command Prompt in administrator mode.

Search for “cmd” in the search bar and right-click on the “Command Prompt” entry that appears there.

Then click on the “Run as administrator” option, and it will launch the Command Prompt as an administrator.

Windows 10 users will have to right-click on the Windows Icon and select “Command Prompt (Admin).”

Step 2: Type the below command in the Command Prompt.

notepad “C:\Windows\System32\drivers\etc\hosts”

It will open up the host file on your computer.

Step 3: Add a non-existing IP for Google Analytics.

Add two lines at the bottom of the hosts file as following:

0.0.0.0 google-analytics.com
0.0.0.0 www.google-analytics.com

Step 4: Finally, Save the hosts file and close all the open web browsers.

Sometimes, you may need to restart your computer for these changes to become effective.

Edit Hosts File - Google Analytics Opt-Out

5. Using Ad-Blockers

Ad blockers have gained more attention recently due to their wide usage. While their primary purpose is to block the annoying (marketing) ads that follow you across the internet, they can also affect collecting traffic data in various ways, such as by blocking Google Analytics.

Ad Blockers do that by blocking any attempts of the Google Analytics JavaScript library to transfer data between websites and analytics servers.

By default, many ad blockers blacklist Google Analytics, while some ad blockers need to be configured.

  • The uBlock Origin is a popular ad blocker that comes as a Chrome extension. It blocks Google Analytics by default and is used by more than 10 million users.
  • The Adblock Plus Chrome extension can be used to block Google Analytics by enabling the Easylist option.

Below are a few simple steps to install and configure Adblock Plus free ad blocker and configure it to block Google Analytics.

Step 1: Visit the Chrome Web Store page of the Adblock Plus extension.

Adblock Plus Extension

Step 2: Click on the “Add to Chrome” button and then click on the “Add Extension” button in the following popup.

Adblock Plus Add to Chrome

Step 3: Now, you will see a small Adblock plus icon in your browser, and it will display a popup when you hover on it.

Using Adblock Plus

Step 4: Click on the Settings icon at the top right of the popup and go to the “Advanced Tab” on the settings page.

Adblock Plus Advanced Settings

Step 5: Turn on the “Easy List” option there to block Google Analytics.

In addition to the above two ad blockers, some other popular ad blockers can block Google Analytics, such as AdBlock Pro, AdGuard AdBlocker, AdRemover, Ghostery, and Block Ads! and SuperBlock Adblocker.

5. Using the Brave Browser

Brave is an open-source, Chromium-based web browser that is free to download and use. It is similar to all the other standard browsers enabling users to navigate websites, view any online content, and run web applications.

However, the primary differentiating factor of Brave, among other Chromium browsers, is its focus on user privacy. By default, Brave achieves this by blocking all ads, third-party cookies, and website trackers like Google Analytics. Therefore, using the Brave browser is a good option for hiding your online activity from Google Analytics while surfing the web.

Since the Brave browser also acts as an ad blocker, blank spaces will appear in the areas of websites that contain ads. Sometimes, the pages won’t load correctly, and in such cases, you will have to either select a different browser or change the ‘Shields Up’ setting to ‘Shields Down’ to turn off the privacy and security protection of Brave.

Below are a few simple steps for downloading and installing the Brave browser.

Step 1: Visit the following link to navigate to the official site of Brave browser.

Step 2: Then, click on the required download option in the middle of the page, and it will download the installable file of the Brave browser.

Download Brave

Step 3: Double click on the installable file, and it will generate a prompt message as shown below. Click “Run” there, and it will install and launch the Brave browser on your PC.

That’s it.

Looks and works like any other web browser:

Brave Browser

6. Using a Script blocker to disable JavaScript

Finally, you can also use an extension that blocks JavaScript from loading for particular domains or servers to opt out of Google Analytics. Numerous extensions are capable of serving this purpose.

You can even disable JavaScript from your web browser. But this method is not recommended since almost all modern websites require JavaScript to run correctly, and blocking JavaScript will break most websites from loading properly.

Final Thoughts

Data is invaluable, and nowadays, most websites collect at least some basic information about their visitors’ behavior.

As a powerful web analysis tool, Google Analytics allows tracking a wide range of data regarding website performance, traffic, and even user behavior.

However, it is also essential that website users feel safe while visiting websites, and for that, they may need to exercise more control over who’s monitoring their online habits.

Therefore, even if blocking Google Analytics can affect the accuracy of analytics data for site owners, it’s a significant privacy concern for visitors.

9 Comments

  • Rob A.

    December 21, 2023 11:57 pm

    I’m not so much interested in protecting my privacy as I am in playing games on Arkadium.com without them choking on Google Analytics.

  • Ted Rodriguez

    December 5, 2023 6:23 am

    How can I block Google analytics on my Android Version 12 phone?

  • Ian

    October 13, 2023 6:11 am

    Great Work

  • Mr andriod

    September 19, 2023 12:47 am

    I really need some help,i have an x that is in evdrything i own i go get a new straight talk phone and shes in it b4 the days out i really really need help i just dont no who to trust,she comes from all directions and it seems like theres something new everyday

  • Mahhn

    February 16, 2023 8:20 pm

    Fyi, JBL software (and I am sure others also) has google analytics built in, and reports to goog. I came here to see what I could do besides blocking their subnets. Thank you for the info on modding the Host file so at least I’m mitigating some of the spyware.

  • Anne

    June 29, 2022 3:50 pm

    Nice advice. But couldn’t you just use a privacy browser such as duck and a VPN?

    • don

      January 26, 2024 2:51 am

      I’m using duck but it doesn’t block google trackers ever after a fire burn. Do you know how to scorch them off too?

  • Rich

    November 10, 2021 5:03 pm

    Yes, I just got that Ah Haa! Moment yesterday while clearing apps from my phone after running “Norton Apps Cleaner” when I suddenly realized why there are so many “FREE” apps and allowing them access to suck the personal information out of my phone and selling it actually ends up costing me way more!! Sure is nice to get a wake up moment like that so getting rid of all non essential apps!

  • Donald duck

    October 29, 2021 5:24 pm

    Interesting post

    I am using adguard premium on my mobile phone as that’s where most of my internet activities are done and adguard seems to be super effective in blocking Google’s analysis process as well as blocking a large percentage of ads

    I just hope that adguard can protect other data that especially installed apps may be collecting such as location info mobile number mobile make model and other sensitive areas as one thing I find with apps is they are shameful people who are collecting data without you knowing and without permissions

Leave a Comment