Bing UET Tag全局+事件代码添加方式

本文档介绍了如何在网站上添加Bing Universal Event Tracking (UET) 的全局基础代码和自定义事件代码。全局代码需放在每个页面的<head>或<body>部分,而事件代码则需在特定事件发生的页面上。提供了事件代码模板,包括Category、Action、Label和Value四个变量,用于匹配转化目标并记录转化。安装步骤包括为事件代码命名、编辑网站代码并插入自定义变量。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

帮助文档:https://help.ads.microsoft.com/#apex/ads/en/56684/2-500

1、加什么?
1)全局代码:基础代码

2)事件代码:自定义事件

2、在哪儿加?
1)UET基础代码需要添加在网站的每一个页面

2)事件代码需要加在事件发生页面

3、 代码文本及安装步骤
1) 全局代码:
全局代码添加在网站的每一个页面或者master page上的head或body层级。也就是说,添加在<head>和</head>之间、或<body>和</body>之间的任意位置。

以下代码文本中均需要替换Tag ID,ID为代码的唯一标识,查看位置:Tools > UET Tags > 相应代码行查看。

<script>(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"替换tagID"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");</script>

2)事件代码:

微软官方帮助文档已经详细介绍了添加步骤,本文档作为中文补充,如在安装过程中有任何问题,请联系责任AM。

① 事件代码模板:

<script>
   window.uetq = window.uetq || [];  
   window.uetq.push ('event', 'Replace_with_Event_Action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});  
</script>

其中变量:

Category:事件类型,如 “Purchase”

Action:事件动作,如 “Purchasebuttonclick”

Label:事件标签,自定义

Value:与事件关联的数值,如果是追踪支付,可回传订单金额

用户在点击广告进入网站后,完成相应动作(如点击某个按钮)触发代码,当代码中以上任意字段和转化目标中设置的字段能够匹配上,会记为一次转化。

② 安装步骤

示例:

需求:客户需要用event代码追踪加购。

安装位置:事件发生页面

Ⅰ. 为代码命名,任意没有在网站上被用过的名字都可以,示例命名为GetCustomEvent():

<script>
   function GetCustomEvent() {

   window.uetq = window.uetq || [];  
   window.uetq.push ('event', 'Replace_with_Event_Action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});  
   }

</script>

Ⅱ. 编辑网站代码,示例中,用户点击确认加购按钮时需要触发代码,因此需要调整按钮本身的代码:

<script>
   function GetCustomEvent() {
   window.uetq = window.uetq || [];  
   window.uetq.push ('event', 'Replace_with_Event_Action', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});  
   }
</script>

   ...
							

<button OnClick="GetCustomEvent()">Add to cart</button>

Ⅲ. 自定义变量,完成代码如下:

<head>Your page title 
</head>

<body>
<script>Your UET tag is here.</script>

<script>
   function GetCustomEvent() {
   window.uetq = window.uetq || [];  
   window.uetq.push ('event', 'addtocart', {});  
   }
</script>

   ... 
							
								
<button OnClick="GetCustomEvent()>Add to cart</button>

   ...
							
								
</body>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值