Google标签管理器 - 如果页面上存在cookie,请触发标签
我在GTM中有一个变量,我们将其称为“ cookie-测试”类型第一派对饼干。我需要一个cookie在页面上存在的触发器。因此,如果存在cookie,则应在这种情况下发射标签。 我该怎么做?
先感谢您!
I have a variable in GTM, let's call it "Cookie - Test" of type 1st party cookie. I need a trigger for when this cookie exists on the page. So, if the cookie exists, a tag should fire under this condition.
How could I do this?
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您创建一个读取cookie的GTM变量。
然后,当您的变量未定义时,创建一个仅发射的触发器。
您唯一需要考虑的是触发大火的事件 - 是在页面加载,某个Datalayer事件上等等。
如果事件无关紧要,则可以创建一个自定义事件触发器,输入“。”作为事件名称,然后选择“匹配” Regex复选框。如果这样做的话,只要定义cookie,它就会在每个事件中发射。对于此解决方案,通常应该在标签设置中选择“每页一次”触发,否则您的标签会发射很多次。
You create a GTM variable, that reads your cookie.
Then you create a trigger which fires only, when your variable is not undefined.
The only thing you need to think about is the event your trigger fires on - is it on page load, on a certain dataLayer event and so on.
In case the event doesn't matter, you can create a custom event trigger, enter ".*" as event name and select the matches regex checkbox. If done so, it fires on every event as long as the cookie is defined. For this solution, you should usually select firing "once per page" in your tag settings, otherwise your tag will fire quite a lot of times.