第 3 步:修改您Bing推广网站中的 UET 标签跟踪代码
按照我们在第 2 步中的示例,假设您要在网页上跟踪的自定义事件是人们单击“立即下载”按钮(这将是一个操作事件,如上所述)。在您在步骤 1 中添加到网页代码的 UET 标记下方添加以下自定义事件 Javascript:
<head>你的页面标题
</head>
<body>
// 假设这是您在步骤 1 中粘贴 UET 标记的位置。
<script>您的 UET 标签在这里。</script>
// 这里是粘贴以下 Javascript 的位置:
<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'});
</脚本>
...
<button>立即下载</button>
...
</body>

给这个代码片段一个函数名。函数名称可以是任何名称,只要它尚未在您的网站中使用即可。在本例中,我们将其命名为“GetCustomEvent()”:
<head>你的页面标题
</head>
<body>
<script>你的UET标签在这里。</script>
<script>
函数 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'});
}
</脚本>
...
<button>立即下载</button>
...
</正文>
您现在需要自定义您的网页代码,以便在发生适当的操作时调用此函数。在我们的示例中,自定义事件是单击“立即下载”按钮,因此我们需要在按钮的代码中添加一个调用:
<head>你的页面标题
</head>
<body>
<script>你的UET标签在这里。</script>
</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'});
}
</脚本>
...
<button OnClick="GetCustomEvent()" >立即下载</button>
...
</正文>
请注意自定义事件 Javascript 中的四个不同参数:“event”、“event_category”、“event_label”和“event_value”。这些对应于您在第 2 步中可以选择为自定义事件转化目标定义的参数。在您添加的 Javascript 中,这些参数具有分配给它们的占位符值:
<head>你的页面标题
</head>
<body>
<script>你的UET标签在这里。</script>
</script>
<script>
function GetCustomEvent() {
window.uetq = window.uetq || [];
window.uetq.push( '事件', ' Replace_with_Event_Action ',{ 'EVENT_CATEGORY': ' Replace_with_Event_Category ', 'EVENT_LABEL': ' Replace_with_Event_Label ', 'event_value': ' Replace_with_Event_Value '});
}
</脚本>
...
<button OnClick="GetCustomEvent()>立即下载</button>
...
</正文>
Bing推广账户根据您添加的 Javascript 需要在自定义事件发生时向 Microsoft Advertising 返回一个值,并且该值需要与您在第 2 步中输入的值相匹配。在我们的示例中,我们正在跟踪按钮点击,即第 2 步中所示的操作事件(并且在 Javascript 中由“事件”表示)。所以我们需要修改“事件”参数的占位符值(我们可以删除其他三个参数):
<head>你的页面标题
</head>
<body>
<script>你的UET标签在这里。</script>
<script>
function GetCustomEvent() {
window.uetq = window.uetq || [];
window.uetq.push ('event', ' downloadbuttonclick ', {});
}
</脚本>
...
<button OnClick="GetCustomEvent()>立即下载</button>
...
</正文>
保存并部署您编辑的网站代码。
微软bing使用自定义事件的提示
uetq 是在页面加载时由 UET 跟踪代码实例化的 Javascript 对象。<script></script> 标记内的代码应在用户操作(例如,单击按钮)完成时实例化。它可以直接连接到 onclick 事件或包装在连接到 onclick 事件的 Javascript 函数中。命令“事件”始终是必需的,即使您没有报告任何事件操作。如果是这种情况,您可以将事件操作设置为:空的。例如:
<脚本>
window.uetq = window.uetq || [];
window.uetq.push('event', '', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});
</脚本>
以下操作之一可能会帮助您识别未来的事件操作:add_payment_info、add_to_cart、add_to_wishlist、begin_checkout、checkout_progress、exception、generate_lead、登录、page_view、购买、退款、remove_from_cart、screen_view、search、select_content、set_checkout_option、share , sign_up,timing_complete, view_item, view_item_list, view_promotion, view_search_results例如:
<脚本>
window.uetq = window.uetq || [];
window.uetq.push('event', 'add_payment_info', {'event_category': 'Replace_with_Event_Category', 'event_label': 'Replace_with_Event_Label', 'event_value': 'Replace_with_Event_Value'});
</脚本>
如果您只跟踪事件操作,则可以从代码中删除其他参数。例如:
<脚本>
window.uetq = window.uetq || [];
window.uetq.push('event', 'Event action', {});
</脚本>
您可以将任何字符串值用于 Replace_with_Event_Category、事件操作和 Replace_with_Event_Label。鉴于它是一个数值,您可以发送不带引号的事件值。例如, <button onclick="window.uetq = window.uetq || []; window.uetq.push({ 'event_category':'Video', 'event':'Play', 'event_label':'产品演示', 'event_value':5 });">播放</button>。事件值 5 不带引号传递。您还可以通过自定义事件传递可变收入。要了解更多信息,请参阅如何使用 UET 报告可变收入。您可以使用UET Tag Helper验证您的自定义事件是否正常工作。
要查看安装在网页正文中的自定义事件 UET 标记跟踪代码的示例,请访问此网页(仅限英文),在网页中右键单击,然后根据您的浏览器单击查看源代码或查看页面源代码。在此页面上,您还会看到一些按钮。单击每个按钮将触发自定义事件。如果使用第三方监控工具如 Fiddler,可以看到生成到 bat.bing.com 的 HTTP 请求报告每个自定义事件。
当您的Bing广告推广网页加载时,它会触发 UET 标记,从而产生大量 HTTP 请求。最重要的请求是“bat.bing”(看起来像“http://bat.bing.com/action/0?ti=...”的请求)。此请求将用户访问您的网页的情况告知 Microsoft Advertising。您可以使用第三方工具(例如 Fiddler)来监控您的浏览器在您的网页加载时发出的所有请求。对于自定义事件,会触发额外的 HTTP 请求以向 Microsoft Advertising 报告相同的事件。该请求与 bat.bing 类似,但它具有不同的参数来报告自定义事件(与仅页面访问相反)。

评论列表