
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.

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.

31 COMMENTS
Gracias! a mi me sirvió
What if my container is not empty?
Sorry, I meant 'what if my container is not empty and has been published'?
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?
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?
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.
Any better way for Nuxt.js?
Sorry, I have no experience with Nuxt.js
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
Hey Kirill, thanks!
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
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?
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/
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
Optimizely should be added to your website outside of GTM (means: directly on your website's code). Website head may contain multiple scripts.
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
Hi Julius,
Sorry, I found out the problem.
Thank you for your precious topic. That helps alot.
Cheers!
Nyein
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!
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.
Kind regards and thank you!
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.
Are you using environments?
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.
I got the same error. Is it due to plugin cache?
I am using the wp rocket plugin
Thank you!
Ifnyou see this even after publishing the containerz the the issue is most likely with the WP rocket's cache.
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!
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.
Do I need to publish the container prior to adding tags. Or can i publish it after and have the same outcome?
It is fine to publish after.
I see in my site GTM tag is loading before I accept the Cookiebot, how to I change this setting?
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.