October 20, 2019
Google Tag Manager 404 error (gtm.js 404)
Updated: October 20th, 2019. So you’ve added a Google Tag Manager snippet to a website (by carefully following the instructions). Website’s developer contacts you and says that Google Tag Manager snippet generates errors (gtm.js 404) and keeps littering his error log. Well, there’s a simple solution for this issue.
404 not found for GET: GET http://www.googletagmanager.com/gtm.js?id=GTM-XXXXX
“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 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).
- If there’s no gtm.js 404 error – go ahead and start setting up your marketing tags.
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 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 a #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.