Does GA Opt-Out Extension Work With Google Tag Manager?

Author By Adam Wells

Last updated: 08/29/2020

Analytics dashboard with a pie chart.

Our company started our website by using the Google Analytics Tag for analytics tracking. We knew that eventually we wanted to start using Google Tag Manager and as we started preparing for the “migration over to Google Tag Manager,” we started wondering if GTM would still allow our GA Opt-Out Extension to block our internal traffic so we can keep our data accurate.

In this post, we are going to go through the steps of how we went about finding that answer.

According to Google, the GA Opt-Out Extension works to block these three types of JavaScript: “ga.js, analytics.js, and dc.js”

The question is: Does GTM honor the Opt-Out Extension by default, or does it need to be set up to honor the Opt-Out request since the Google Tag Manager script is “gtm.js”? Perhaps the extension will still work since the GA tracking code is “gtag.js” and the opt-out extension works on it. But maybe it won’t work — since I found a blog / article discussing how to set up a custom configuration in order to respect the Opt-Out of advertising and analytics requests of visitors.

Perhaps the easiest way to find out the answer to my question, is to test the extension on ourselves when using GTM. Just remember, if you are not using GTM and you are just using the GA script / tracking code, then the GA Opt-Out Extension should be working and if it is not, then you may have some type of code bypassing the extension which is not good in terms of complying with Google policies etc.

Testing GTM and GA Opt-Out Extension

So, we went into our GTM Account and setup a “Testing Container” so that we can find an answer to this question.

We verified that the trigger is firing the tag for pageviews.

We turned our GA Opt-Out Extension off.

Then we ensured that our tag was working in Google Analytics by going to the Real Time >> Content Report. In the image below, you will see that the “Active User” in the “Right Now” slot is 1. The key here is to see that the pageviews were counting as 2 on each page for me (shown by the green arrow in the image). This is because I still have the Google Analytics Tracking Code on our website as well as I added the Google Tag Manager Tracking Code / Container to our website for the purpose of this blog post. So each pageview is getting recorded twice (which is okay for testing purposes, but not okay if you are doing this unknowingly for a prolonged period of time).

I navigate to the “About Us” page just for additional confirmation that the GTM tag was working. Still counted as 2 pageviews.

Then for final confirmation, I went to our “Website Development” page and the pageviews dropped down to 1 as expected. This is because I only added the GTM testing container to the Home Page and About Us page for testing (I am removing the container as soon as I am done with this blog post.

Now the next step is to see if GA Opt-Out is still working for GTM. I know it works for the Google Analytics tag because I have previously tested it out. So if we still get a pageview after turning the Opt-Out Extension back ON, it is because GA Opt-Out Extension does not work when GTM is collecting and sending the data.

I went and turned GA Opt-Out Extension back ON.

To find that:

There are 0 active users which means that GA Opt-Out Extension still works to block internal traffic from corrupting Google Analytics data when you are using Google Tag Manager. Good news.

You may be wishing that I would have just said that from the beginning but in my defense this was a curiosity that I had and I decided to literally write this blog post as I was testing and finding out the answer.

Before resorting to testing this myself, I Googled for the answer but could not find anything specific on it. Perhaps this is because gtag.js and gtm.js are literally the same thing — hence the extension “.js”, but I do not know a ton about code (yet) so I just wanted to ensure that we are following best practices. I probably should have just asked our developer, but what fun would that be.

We hope you found this post interesting and enjoyable. If you are anything like me with your curiosities, overthinking, and worries — now we both can sleep a little better knowing that we can still block internal traffic with the GA Opt-Out Extension.

Oh, and by the way, I remembered to take the “Testing Container” code back off of our website. Whoo, that was a close one. 😅

Are You Ready To Take Your Business To The Next Level?

If you are looking for help with Google Ads, Google Merchant Center, Data Tracking, or you’re looking for development of a Powerful Custom Website Theme, we really believe we are among some of the best companies out there to deliver your business the best results.

Leave a Reply

Your email address will not be published. Required fields are marked *

Ready to take your website to the next level?

Get actionable insights and improvements for your website delivered straight to your inbox. Sign up below.

Astronaut floating in space