How WordPress Users Can Opt Out of Google Analytics Tracking

Last Updated on January 2, 2023 by 12 Comments

Editorial Note: We may earn a commission when you visit links on our website.
How WordPress Users Can Opt Out of Google Analytics Tracking
Blog / WordPress / How WordPress Users Can Opt Out of Google Analytics Tracking
Play Button

Data is the new gold. Almost every website and app collects at least some information about users’ behavior. However, some of your visitors may want to exercise more control over who’s monitoring their online habits. That’s why if you’re using a tool such as Google Analytics, providing an opt-out link is a move in the right direction.

In this article, we’re going to break down why enabling your users to have control over their data is in your best interest. Then we’ll teach you how to set up a Google Analytics opt-out link and test it in three steps.

Let’s get to work!

Subscribe To Our Youtube Channel

Why You Might Want to Let Users Opt Out of Google Analytics Tracking

It’s not a surprise that most websites collect information about user behavior. This practice is helpful for a wide variety of reasons that benefit both site owners and visitors, including marketing and Conversion Rate Optimization (CRO), as well as User Experience (UX) auditing.

Depending on which analytics tools are used, at any moment, at least some of the following information is being collected for a site’s guests:

  • How much time visitors spend on the website and on which pages
  • What searches led them to the content they’re viewing
  • The specific actions they take once they’re on the page
  • Individual IP addresses and which browsers visitors use

All that information sounds harmless. However, once websites and apps start sharing data with each other, it gets to the point where marketers can get an eerily accurate picture of who you are. For some, this is unnerving. Others may find the relentless stream of targeted ads annoying.

In many ways, the data we provide to websites and apps is the price we pay to get better product recommendations, search results, individualized offers, and more. On paper, it all makes for a better web experience. However, if you want to opt out of tracking, it should be within your ability to do so.

Fortunately, this is a right of all web users in many jurisdictions. There are legal reasons why websites inform you they’re collecting cookies and enable you to say no to tracking altogether.

Offering a Google Analytics opt-out option is just another way of empowering your own site’s visitors to decide who gets access to their information. Even if a percentage of your users decide to block data tracking, chances are you will still collect enough to make informed decisions regarding marketing, UX, and more.

How to Let WordPress Users Opt Out of Google Analytics Tracking (In 4 Steps)

For this tutorial, we’re working off the premise that you already have Google Analytics connected to your website. If you haven’t gotten around to it, you don’t need an analytics opt-out link yet. With that in mind, let’s jump in.

Step 1: Install and Activate the Google Analytics Opt-Out Plugin

Google Analytics works by loading a script every time someone visits your website. That code collects information and sends it to the platform, which serves it up to you in easily readable charts and graphs:

An example of an Analytics report.

If you want to give users the ability to opt-out of tracking, you need to disable that script. The Google Analytics Opt-Out plugin generates a long-term cookie that does just that:

The Google Analytics Opt-Out plugin.

This workaround is necessary so each of your visitors can choose whether to disable Google Analytics tracking individually. If they ever want to opt back in, however, they’ll need to clear their cookies.

Google Analytics Opt-Out is a free plugin available in the WordPress Plugin Directory. You can install it right from your admin dashboard by navigating to Plugins > Add New and searching for it.

Step 2: Add Your Tracking Code and Configure the Plugin’s Settings

Configuring the plugin is fairly simple. Once you install and activate it, go to Settings > Analytics Opt-Out in your admin sidebar

For the plugin to work, you’ll need to enter your Universal Analytics (UA) or Google Analytics (GA) code, depending on which you’re using to track data on your site:

Configuring the opt-out plugin.

These are the codes Google Analytics uses to identify your ‘properties’ on the platform and to link it to WordPress. To find out your code, go to your Google Analytics account and open your website’s linked property:

Accesing your analytics Admin settings.

Click on the Admin button in the lefthand sidebar menu and open the Tracking Info > Tracking Code section:

Retrieving your analytics tracking code.

What you’re looking for is the Tracking ID at the top of the page. Copy it, return to WordPress, and paste it in the corresponding field.

If you’re using the Monster Insights plugin, you can skip this step by enabling the Use Monster Insights Settings option under Settings > Analytics Opt-Out. The Google Analytics Opt-Out plugin will then automatically use the tracking code you entered previously to connect your site.

Once the plugin is working, you can add an opt-out link to your website. One quick note, though – if you’re using the Classic Editoryou’ll have to enable the Show Editor button (Classic Editor) option in the plugin’s settings before proceeding to the next step.

Step 3: Create an Opt-Out Link for Your Website

The Google Analytics Opt-Out plugin automatically adds an Analytics Opt-Out block to the Block Editor. All you have to do is add this element wherever you want it to appear and create the anchor text it should include:

Using the opt-out block.

By default, the plugin will add a barebones link to your website. Once you click on it, it will display a confirmation message, informing you that Google Analytics tracking will be disabled for you from the next time you visit:

The analytics opt-out confirmation message.

The link works, but it’s not very visually appealing. Plus, visitors are liable to pass over it if you don’t make it more apparent. If possible, we recommend adding the opt-out setting to a secondary menu that’s hard to miss. You can easily accomplish this with Divi.

If you’re using the Classic Editor and you enabled the corresponding setting in during the second step, you can also easily incorporate an opt-out link on your site’s pages:

Using the Classic Editor to add an opt-out button.

Clicking on the Analytics Opt-Out button in the editor toolbar will provide a shortcode you can place anywhere you want. It works exactly like the Block Editor link shown above.

Step 4: Test If Your Website is Sending Data to Google Analytics

Setting up an analytics opt-out link for your website is simple, but it’s wise to check that it’s actually working as it should. The easiest way to do that is by using your browser’s developer tools.

For example, if you’re using Chrome, you can right-click anywhere on your website and select the Inspect option. Once the console is open, go to Application > Manifest and look for a cookie with a name starting with ga-disable:

Checking if the Google Analytics opt-out cookie is working.

If that cookie’s value is set to True, it means Google Analytics won’t be tracking your data on that particular website. The same should be the case for any user who clicks on the link you’ve added to your site.

Conclusion

Almost every website tracks your behavior in one way or another. It sounds nefarious, but it’s that data that enables other services to understand what you want and provide relevant recommendations. Even so, it’s only natural some might not feel comfortable sharing all that information. That’s why letting users opt out should be the default practice.

To give your visitors control over their data, you can add a Google Analytics opt-out link to your site in four steps:

  1. Install and activate the Google Analytics Opt-Out plugin.
  2. Add your tracking code and configure the plugin’s settings.
  3. Create an analytics opt-out link for your website.
  4. Test if your website is sending data to Google Analytics.

Do you have any questions about adding a Google Analytics opt-out link to your site? Let us know in the comments section below!

Article thumbnail image by La1n / shutterstock.com

Divi

Want To Build Better WordPress Websites? Start Here! 👇

Take the first step towards a better website.

Get Started
Divi
Premade Layouts

Check Out These Related Posts

5 Unique Ways To Leverage AI In Your Web Design Workflow

5 Unique Ways To Leverage AI In Your Web Design Workflow

Posted on December 10, 2024 in WordPress

Artificial intelligence (AI) is changing how we design and develop websites in today’s digital environment. Divi AI, a powerful tool integrated into the Divi theme, offers designers and developers a treasure trove of benefits. By leveraging Divi AI, you can streamline your workflow, save...

View Full Post
WordPress Twenty Twenty-Five Review: 6.7 Features Worth It?

WordPress Twenty Twenty-Five Review: 6.7 Features Worth It?

Updated on December 9, 2024 in WordPress

WordPress recently launched its new default theme, Twenty Twenty-Five, along with WordPress 6.7. With new features and customization options, it offers more flexibility than the Twenty Twenty-Four WordPress theme. But is it worth making the switch? We put the new theme to the test and compiled this...

View Full Post

12 Comments

  1. I have a website on WordPress and I also installed Google Analytics plugin but somehow it is not working properly I check many blogs but I am not getting my solution but after reading this article I am able to set up the google analytics for my website and hopefully it works properly for me. I am happy to see this important & valuable information the free of cost. Thank you once again for sharing this information with us.

    • Hi Abhay, I’m happy to hear Google Analytics is working for you now! Don’t worry if you’re not seeing any numbers right away — it all depends on how much traffic you’re getting, but you should start to see data soon.

  2. Great post for WordPress users. Just curious to know why anyone would like to opt-out for tracking the data through Google Analytics. It gives so much insightful information about a website marketing plan.
    Thanks!

    • Hello Abhay, I’m happy you found the article interesting! Some users have concerns over their privacy and don’t like the idea of their behavior getting tracked, so it can be a good approach to offer them that option.

  3. What is the best pro plugins to maintain Google analytics opt out pls reply me sir…

    • Hello mobavan! There still aren’t many plugins that tackle this particular issue, so I’d recommend you stick with this one for now since we’ve run tests and we know it works.

  4. Been searching about this for a second. This is great to give users the choice of opting out of google analytics. even after being in the internet world for a while, the word ‘tracking’ still scares me. it’s cool that people who do not feel great about it can op out. Great Job

    • Hello Godwin, I’m glad you enjoyed the article! We’re definitely of the mind it’s always a great idea to give your users more control over their data.

  5. Hmmmm, could this be the beginning of the end of google’s stranglehold over web owners and users? We don’t use any of their products. We use an open source analytics product that provides similar data without google’s dark shadow hanging over our and our users’ heads.

    Good article, thank you.

    • Hello Bee! It’s definitely better for the web that one company doesn’t have a stranglehold over all your activity. It’ll be interesting to see where Google’s at in a few years.

  6. It’s a great tutorial but in all honesty it doesn’t make any sense, unless it’ll become mandatory in the future.
    GDPR cookie acceptance has become so common in EU that I wonder if anyone has any data on how many visitors choose not to be tracked… because since it came out, I accept every single time to be tracked…
    Everyone want to track visitor behavior.
    How else a website will ever improve or deliver content that one is interested in?

    Next thing is the EU or California will demand each supermarket to give all visitors a choice whether they want to be tracked what they are buying, when and how much they spent. Visitor will be able to opt in if they want to be on CCTV cameras… and they can demand the store to delete all previous recordings to respect their privacy… it’s personal data.. because some of them open their phone with their face!

    ¯\_(ツ)_/¯

    • Some statistics show that fewer than 1% of users opt-out of cookie tracking, despite being given the option. It’d definitely be interesting to see if that figure holds with analytics tracking!

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Get Started With Divi