请输入
菜单

将您的 UET 标签更新为新的语法

不知道UET是什么?请查看什么是 UET,它如何帮助我?

我们已更新了JavaScript UET标签的语法。我们建议您更新网站代码中的任何现有UET标签,以利用新的语法。

使用新语法的好处

新的语法:

  • 自动对参数值进行URL编码(百分号编码),确保您的URL不会被错误翻译。
  • 支持单页应用程序(SPA)网站。
  • 让您为网页上任何兼容的UET事件设置页面级参数。
  • 具有易于理解的参数名称,帮助您组织和管理它们。

更新后的标签有什么不同?

  1. 自定义事件和可变收入的 UET 标签现在都需要事件操作参数,并且该参数在两种情况下都出现在第一位。
  2. 自定义事件和可变收入的 JavaScript 参数名称现在更容易理解:
旧语法 新语法
ea event
ec event_category
el event_label
ev event_value
gv revenue_value
gc currency

比较语法

旧语法(自定义事件)

<script>  
   window.uetq = window.uetq || [];
   window.uetq.push ({'ec': '替换为事件类别', 'ea': '替换为事件操作', 'el': '替换为事件标签', 'ev': '替换为事件值'});
</script>

 

新语法(自定义事件)

<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>



旧语法(可变收入)

<script>  
   window.uetq = window.uetq || [];
   window.uetq.push ({'gv': 'Replace_with_Revenue_Value', 'gc': 'Replace_with_Currency_Code'});
</script>

 

新语法(可变收入)

<script>  
   window.uetq = window.uetq || [];
   window.uetq.push ('event', '', {'revenue_value': 'Replace_with_Revenue_Value', 'currency': 'Replace_with_Currency_Code'});
</script>

 

示例

跟踪所有四种自定义事件类型

<script>  
   window.uetq = window.uetq || [];
   window.uetq.push ('event', 'Contoso_Event_Action', {'event_category': 'Contoso_Event_Category', 'event_label': 'Contoso_Event_Label', 'event_value': 'Contoso_Event_Value'});
</script>

 

不跟踪事件操作,但跟踪另外三种事件类型(注意“事件”保留其空值):

<script>  
   window.uetq = window.uetq || [];
   window.uetq.push ('event', '', {'event_category': 'Contoso_Event_Category', 'event_label': 'Contoso_Event_Label', 'event_value': 'Contoso_Event_Value'});
</script>

 

仅跟踪事件操作(注意,其他不必要的事件类型已被删除):

<script>  
   window.uetq = window.uetq || [];
   window.uetq.push ('event', 'Contoso_Event_Action', {});
</script>
上一个
使用 UET 标签助手测试转化目标和受众
下一个
常见问题解答:通用事件跟踪
最近修改: 2024-03-12Powered by