Google 跟踪代码管理器容器 - 开发人员。网站到已发布网站的建议
我只是想确保在下周发布我们的网站时能够正确地解决这个问题,该网站已经添加了一些页面。非常感谢任何建议。
因此,截至目前,我们在 Google 跟踪代码管理器中拥有一个原始容器(容器 1),它已经设置了一些标签并正在运行,非常棒。 上周,我在 GTM 中创建了一个新容器(容器 2),并一直使用它来测试我们的开发。网站。在我们网站的新页面中添加一些标签,以便我准备在网站上线后将它们添加到我们实际发布的网站中。
当我创建容器 2 时,我将 GTM 代码发送给开发人员,他将其放入开发人员的标头中。网站 我的问题是......当我们发布开发时。我们是否需要从标头中删除该代码并将其替换为容器 1 的代码,这样我们就可以对现有标签进行操作,而我只需复制我在容器 2 中创建的几个标签?
澄清:我想保留容器 1 中的标签并使用此容器,因为网站仍然需要所有这些标签,我只是为网站的其他页面创建标签,否则保持不变。
I just wanted to make sure I would be approaching this problem correctly when it comes time to publish our website next week that has had a few pages added onto it. Any advice is greatly appreciated.
So, as of right now we have an original container (Container 1) in Google Tag Manager, it has a few tags set up and working, great.
Last week, I created a new container in GTM (Container 2) and have been using that to test our dev. website. Adding a few tags to the new pages of our website so I am ready to add them to our actual published website once it goes live.
When I created Container 2 I sent the GTM code to the developer and he put it into the header of the dev. website
My question is.. when we publish the dev. website are we going to need to remove that code from the header and replace it with Container 1's code that way we are operating on the existing tags and I only have to replicate the few tags I made in Container 2?
Clarification: I want to keep my tags from Container 1 and use this container as the website still needs all these tags, I was just creating tags for additional pages to the website, it has otherwise remained the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在我们已经概述了应该如何完成事情,让我们来回答您的问题:手。
基本上,您的问题是询问您的开发人员在将下层推送到产品时是否会用容器 2 替换容器 1。问问他们。但一般来说,最好做好三件事:
让开发人员永远不要将 GTM 代码从开发版本推送到产品版本,并在开发版本和产品版本上维护不同的 GTM 代码段。
在您的容器中拥有通用的与容器无关的跟踪逻辑,这样即使开发人员将开发容器推送到生产环境,您的跟踪仍然是完美的,并且所有事件都将发送到生产 GA 而不是开发 GA。
具有通用的、与容器无关的逻辑,如果 console. 检测到在产品上使用开发容器,则会发出 GTM 消息警告。
那里。
简而言之,对您来说最简单的事情就是始终将容器 1 保留在生产环境中,将容器 2 保留在开发环境中,但保持它们之间的对等性,并在每次完成工作时将更改从 2 移至 1。这是权宜之计。
正确的做法是完全删除容器 2,在容器 1 中创建一个环境,将较低环境容器 1 的代码部署到开发人员,通知开发人员该容器仅用于开发人员,并确保您的代码是通用的。
Now that we've overviewed how things should be done, let's get to your question at hand.
Your questions is, basically, asking whether your developers are going to replace container 1 with container 2 when pushing the lowers to prod. Ask them. But generally, it's better to have three things in place:
Have developers never push the GTM code from dev to prod, maintaining different GTM snippets on dev and prod.
Have a universal container-agnostic tracking logic in your containers, so that even if the developers push the dev container to prod, your tracking is still perfect and all the events are going to the production GA rather than dev GA.
Have a universal, container-agnostic logic that console.warns a GTM message if it detects that the dev container is being used on prod.
There.
In short, the easiest thing for you is to keep container 1 on prod and 2 on dev always, but maintain parity between them and move changes from 2 to 1 every time you're done with your work. That's the expedient option.
The proper thing to do is to remove container 2 completely, create an environment in container 1, have your lower env container 1 code deployed to dev, notify the devs that that container is for dev only and make sure your code there is universal.