「GTM」gtm.js Loading Shows 404 Error | BCS 「GTM」gtm.js Loading Shows 404 Error | BCSBCS

「GTM」gtm.js Loading Shows 404 Error

Google Tag Manager BCS 5 years ago (2020-02-28) 4677 Views 0 Comments

Update time: Jan 17, 2025

Some people may encounter gtm.js failed to load and displayed 404, for example:
「GTM」gtm.js Loading Shows 404 Error

There are several reasons:

No Released Version

 If it is a newly installed GTM, no released version has been released yet, gtm.js will be 404

Solution:just publish a version on GTM.

 

Browser Plug-in Blocking

There is a browser plugin blocking gtm.js, eg:

「GTM」gtm.js Loading Shows 404 Error

Solution : check the plugins on the browser or remove them

Plug-in can also cause other problems, refer to: Impact of Browser add-ons on Google Analytics 4

Content Security Policy(CSP)

CSP blocks GTM requests.

Check in the browser developer tools and will see a CSP error.

Solution : Add the following code to the header of all pages:

<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' www.googletagmanager.com www.google-analytics.com; connect-src 'self' www.google-analytics.com; img-src 'self' data: www.googletagmanager.com www.google-analytics.com; style-src 'self'; frame-src 'self' www.googletagmanager.com">

 

Wrong Container ID

The wrong container ID causes the page to fail to load, so 404 is displayed.

If my GTM container ID is GTM-PHXQ69M, but I installed GTM-PHXQ69M1, 404 will be displayed, such as:

「GTM」gtm.js Loading Shows 404 Error

Solution: Check whether the container ID is correct

 

Browser cache or DNS issues

Browser’s cache or DNS records may be preventing you from accessing the latest or correct GTM scripts.

Solution :Try clearing your browser cache or flushing your DNS.

 

 

 Container Code Incorrectly Placed

If not placed correctly, it may cause the script to not load as expected.

Solution: GTM Container code must be placed within the <head> tag or at the very top of the <body> tag.


If you don't understand, You can leave a comment below.
Like (3)
Post my comment
Cancel comment
Expression Bold Strikethrough Center Italic

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • Website