Google Tag Manager Exclusion Not Working

Deploying GTM with a directory exclusion isn’t working.

I have added a script via Google Tag Manager and it fires on all pages with the exception of a single directory. However, when visiting a page that should be excluded, the script still fires until I force a refresh, then the script stops firing. If I go to another page outside the excluded directory, the script doesn’t fire there either. It’s a very strange result.

Has anyone ever experienced anything like this? I’m hoping to narrow down whether it’s user error, GTM functionality, or Netlify caching - which I don’t believe it has anything to do with Netlify based on its nature.

Hi, @dhil, while you are welcome to ask about Google Tag Manager here and others may answer, our support team limits our answers to technical support for our service.

While our support team won’t answer a questions like this (in most cases - never say never), these questions are still definitely welcome here.

We’ll definitely be happy to troubleshoot to help you either prove it is Netlify or exclude us as a possible root cause.

It could be a redirects issue relating to single-page applications. Probably not but this is the mostly likely explanation I can imagine. I don’t suspect our caching as our cache invalidation is quite effective.

If you want our team to take a look to see if it is Netlify related or not, please send us the URL where it should not run and also let us know how you are testing to confirm the script is running.

If you do this, we’ll be happy to research to confirm if the issue relates to how we host the site or if it relates to the site code itself.

Right. Because of the nature of the problem, I wanted to put it out to the community to see if anyone had come across the issue. I couldn’t discount the possibility that Netlify might have something to do with it even though I don’t believe that it does. Also, since we are not running the site as a SPA, I thought it was curious that it was the only “answer” I found. I think we’ll get it sorted with some reconfiguration.