当值出现在我的数据层中时,如何在GTM中触发代码? [英] How do I fire a tag in GTM when a value appears in my data layer?

查看:114
本文介绍了当值出现在我的数据层中时,如何在GTM中触发代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网站加载后,我的网站将值加载到我的数据层中.当某些值出现在我的数据层中时,我想触发代码,并将我的数据层项合并到代码中(例如,订单ID).

My website loads values into my data layer after the website loads. I'd like to fire tags when certain values appear in my data layer, and incorporate my data layer items into the tag (for example, an order id).

我该如何实现?

谢谢!

推荐答案

我假设您正在对dataLayer进行推送".使用键事件"以及您的订单ID推送变量:

I assume you are doing a "push" to the dataLayer. Push a variable with the key "event" along with your orderid:

dataLayer.push({
'orderid' : '12345',
'event' : 'myEvent'
});

然后创建一个触发类型custom event,其中"event name equals myEvent"并使用它来触发您的代码:

Then create a trigger type custom event where "event name equals myEvent' and use this to trigger your tag:

这篇关于当值出现在我的数据层中时,如何在GTM中触发代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆