Google 跟踪代码管理器的 404 错误

404 error for Google Tag Manager

Google 标签管理器让我把它放在开头的 body 标签下面。

<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->

现在我得到这个 404 not found for GET:

GET http://www.googletagmanager.com/gtm.js?id=GTM-XXXXXX

我昨晚实现了代码。这只是需要时间,还是需要修复?如果是后者,我该如何解决?

您需要 publish 一个版本的容器。如果未发布,请求将 return 404 错误。

To publish your current workspace:

  1. Click Submit at the top right hand side of the screen. The Submit Changes screen will appear, with options to publish the container and save a version of your container.
  2. Select Publish and Create Version if it is not already selected.
  3. Review the Workspace Changes section to see if your configuration appears as you expect.
  4. Enter a Version Name and Version Description.
  5. If you have Tag Manager configured to use multiple environments, use the Publish to Environment section to select which environment you'd like to publish to.
  6. Click Publish.

即使在发布后我也遇到了同样的问题,只需从标签管理器域“https://googletagmanager.com" instead of "https://www.googletagmanager.com

中删除子域 "www" 即可解决此问题

问题似乎是 DNS 阻止了 www.或者子域没有正确地重新路由到我们的区域!

我的问题是启用了 AdBlock。

您必须在创建容器后发布它。容器是空的不要紧,直接发布即可。

在我的情况下,当我离开预览并再次午餐时它有所帮助。当我想出我的预览 "outdated" 不知何故...

截至撰写本文时,您无需发布容器即可在首次创建容器时修复错误 404。你可以做一个预览,错误 404 应该消失了。