• Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login
  • Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login

June 15, 2021

Google Tag Manager 404 error (gtm.js 404)

Updated: June 15th, 2021. So you’ve added a Google Tag Manager snippet to a website (by carefully following the instructions). The website’s developer contacts you and says that the Google Tag Manager snippet generates errors (gtm.js 404) and keeps littering his error log. Well, there’s a simple solution to this issue.

An error in the Javascript console you are seeing should look like this (replace GTM-XXXXX with your Google Tag Manager’s Container ID):

404 not found for GET: GET http://www.googletagmanager.com/gtm.js?id=GTM-XXXXX

Or maybe you are using a Google Tag Assistant and it shows the following error when you click on your Google Tag Manager container ID:

“http response code indicates tag failed to fire: status 404. this could be due to an empty or un-published container”

Both of these errors are caused by the same issue.

 

The solution to gtm.js 404 error

The problem lies within Google Tag Manager itself. Your browser is requesting data from Google’s servers although that container is still not published yet, thus no data will be returned. The solution here is to publish the Google Tag Manager container once you create it.

Google Tag Manager Ebook Bundle

Always complete the following actions when you plan tracking of the new website with GTM:

  • Create a new container in GTM.
  • Publish it (with default settings).
  • Install GTM to your website according to instructions (or ask a developer to do it).
  • Open your website in a browser and check Javascript Console (if you’re not familiar with it, here are short Chrome, Firefox and Internet Explorer instructions).
  • If there’s no gtm.js 404 error – go ahead and start setting up your marketing tags.

This isn’t a big problem, but if your developers are tracking Javascript errors with particular tools (e.g. TrackJS), they’ll see those 404 errors in reports. This will create an unwanted noise for them (yes, I know they can use filters, but simply publishing an empty container won’t hurt anybody).

 

If publishing did not help

If the aforementioned solution did not help, try disabling your GTM preview mode and enable it again. In browser, close the website where you have enabled the preview mode and also close the window/tab of tagassistant.google.com (GTM’s preview mode).

Then click the Preview button once again in GTM’s interface.

Then refresh the page where you saw that gtm.js 404 error and see if it still persists.

 

Conclusion

Every time you set up a new Google Tag Manager container, publish it (even though it’s totally empty). Otherwise, the response from Google will return a 404 not found error. This isn’t a critical error but might cause a little mess in developers’ error logs. This is a common rookie mistake which is #2 on my list of most common Google Tag Manager mistakes. Make sure you check the full list.

If you have any other questions related to Google Tag Manager, feel free to post a comment or contact me via social media accounts. Also, consider subscribing to my newsletter for more relevant GTM or Google Analytics tips and guides.

Julius Fedorovicius
In Google Tag Manager Tips
31 COMMENTS
Antonio Leiva
  • Apr 13 2018
  • Reply

Gracias! a mi me sirvió

Audrey Chih-Peng Chou
  • Jun 13 2018
  • Reply

What if my container is not empty?

    Audrey Chih-Peng Chou
    • Jun 13 2018
    • Reply

    Sorry, I meant 'what if my container is not empty and has been published'?

      Julius Fed (Fedorovicius)
      • Jun 13 2018
      • Reply

      If the container was published at least on to the Live environment, that error should appear in the console. Maybe you have two containers on a page and one of the is not published?

Raw Hasan
  • Jun 23 2018
  • Reply

Thanks JULIUS! It saved my life!!

Tag Assistant was showing as tag manager not setup correctly. But after I published it, it is showing as working now.

Although tag manager is working, Tag Assistant is still showing this as error: "GTM no-script code not found: either missing or not in " although I have the code installed in the body. Any solution for that?

    Julius Fed (Fedorovicius)
    • Jun 23 2018
    • Reply

    Yes, add the 2nd code of GTM container (noscript) right after the opening body tag. Although that code is not very important, so feel free to ignore the error.

Jonny
  • Aug 28 2018
  • Reply

Any better way for Nuxt.js?

    Julius Fedorovicius
    • Aug 28 2018
    • Reply

    Sorry, I have no experience with Nuxt.js

Kirill
  • Sep 12 2018
  • Reply

Hey Julius,

I was following your blog for a while and have accidentally found the article on 404. Thank you for your effort and your help!

You definitely have one of the best resources on GTM solutions!

Cheers from Australia,
Kirill

    Julius
    • Sep 12 2018
    • Reply

    Hey Kirill, thanks!

Daniel
  • Dec 27 2018
  • Reply

Hi Julius Fed (Fedorovicius),
thank you so much for the step-by-step information. Being basic in GTM, I created an account and implement it on my website. When I check I received an error - "Multiple installations of Google Tag Manager detected" and unfortunately I'm unable to solve this concern.
My domain is investwellonline[.]com

Amanda
  • Feb 8 2019
  • Reply

Two questions: If I set up google analytics first and am now setting up GTM, how should I integrate GA into GTM?

I have a website with a single page and lots of content. I want to track how far users are getting on this page. Do you have recommendations on how to use GTM to do this?

    Julius Fedorovicius
    • Feb 25 2019
    • Reply

    Hi,

    1. You should create GA tags in GTM and then ask developers to remove GA tracking codes from the website's source code.
    2. If the page is not utilizing infinite scroll, then there are several options:
    a) Use scroll tracking
    b) Use Virtual Pageviews tracking with History Change trigger https://www.analyticsmania.com/post/single-page-web-app-with-google-tag-manager/ or with thelp of developerhttps://www.bounteous.com/insights/2018/03/30/single-page-applications-google-analytics/

arti patel
  • Jun 26 2019
  • Reply

Hello,

I need to change google tag manager position into header means I want to add optimizely script before GTM script how it is possible?

I using below GTM.Js:
https://www.googletagmanager.com/gtm.js?id=GTM-WP33SZV

Please help me for this

    Julius Fedorovicius
    • Jun 26 2019
    • Reply

    Optimizely should be added to your website outside of GTM (means: directly on your website's code). Website head may contain multiple scripts.

Nyein
  • Aug 8 2019
  • Reply

Hi Julius,

Thank you for sharing this topic.
May I know why my GTM still showing 'Container Not Published' although I did published once for the first version? And, it still showed 404 error on console.

Best Regards,
Nyein

    Nyein
    • Aug 8 2019
    • Reply

    Hi Julius,
    Sorry, I found out the problem.
    Thank you for your precious topic. That helps alot.
    Cheers!
    Nyein

Cha
  • Feb 3 2020
  • Reply

Hi Julius
After I read this post, I published to container. After that, on one computer I use, there is no error anymore but on another one, the error still occurs although I use the same chrome version on both computers. How can this be?
Kind regards and thank you!

    Julius
    • Feb 3 2020
    • Reply

    Caching mightb bean issue. Try clearing the browser or wait for a bit longer.

    If your website is using cloudflare (ask developers), clear the cache there too.

Ömer Ölmez
  • Feb 14 2020
  • Reply

Kind regards and thank you!

Rodney
  • Mar 11 2020
  • Reply

I am having this problem on a client's website but the container has already been published. The thing is some tags I published on the site are already capturing data like I can see my FB Pixels already have activity but the container is still saying it is unpublished.

    Julius Fedorovicius
    • Mar 11 2020
    • Reply

    Are you using environments?

Shravya
  • Apr 6 2020
  • Reply

Hi Julius,

I have published my GTM container. In spite of that, I get a 404 error in the console.
How do I resolve it ??
Thanks in advance.

Tôi Thảo Mộc
  • Apr 8 2020
  • Reply

I got the same error. Is it due to plugin cache?
I am using the wp rocket plugin
Thank you!

    Julius
    • Apr 8 2020
    • Reply

    Ifnyou see this even after publishing the containerz the the issue is most likely with the WP rocket's cache.

PalanceH
  • May 1 2020
  • Reply

Thank you for solving this nagging problem for this non-developer. I thought I inserted the Tag Manager snippet incorrectly. I didn't realize I didn't publish the default container. Thanks!

Alok
  • Jul 12 2020
  • Reply

It's working for me thanks a lot.
A quick request, if you can add a step by step process with Google Tag manager account screenshots for non technical users.

ron cahlon
  • Aug 31 2020
  • Reply

Do I need to publish the container prior to adding tags. Or can i publish it after and have the same outcome?

    Julius
    • Aug 31 2020
    • Reply

    It is fine to publish after.

nanna
  • Jan 21 2021
  • Reply

I see in my site GTM tag is loading before I accept the Cookiebot, how to I change this setting?

    Julius Fedorovicius
    • Jan 22 2021
    • Reply

    Why do you think this is a problem? GTM does not store any data about a user by itself, so you can activate it without asking for consent. However, you have to configure tags within GTM to fire then consent is given.

Leave a comment Cancel reply

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

 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and Google Analytics. Join thousands of other digital marketers and digital analysts in this exciting journey. Read more
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
Recent Posts
  • Introduction to Google Tag Manager Server-side Tagging
  • 3 Ways to Pull Data from Data Layer with Google Tag Manager
  • Cannot See the Google Tag Manager Option in Google Ads Conversion?
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings