简体   繁体   English

如何防止Google Tagmanager更改javascript值?

[英]How prevent Google Tagmanager from changing javascript values?

This is the Custom Html Tag that is in Google Tagmanager: 这是Google Tagmanager中的自定义HTML标签:

<script>
 _dAutomationGtmAddTimer("mysite.com", "bh2Ry58My0NWFw==", {"cmp1": 
 visitorContactInfo[0], "cmp2": visitorContactInfo[1], "cart_data":[{"amount":orderFormProducts[quantity],"id":orderFormProducts[sku],"image":"","link":"URL produto","name":orderFormProducts[name],"description":"","unitary_value":orderFormProducts[sellingPrice]}]})
</script>

The second parameter "bh2Ry58My0NWFw==" , when injected to the DOM by Tagmanger changes to "bh2Ry58My0NWFw\\x3d\\x3d" , replacing == with \\x3d\\x3d . 当第二个参数"bh2Ry58My0NWFw=="由Tagmanger注入DOM时,更改为"bh2Ry58My0NWFw\\x3d\\x3d" ,用\\x3d\\x3d替换==

Please, any idea how to prevent this value from changing? 请知道如何防止此值更改?

Try this approach: 试试这个方法:

First , create a Constant Variable: 首先 ,创建一个常量变量:

  • Variable name: API key 变量名称:API密钥
  • Variable value: bh2Ry58My0NWFw== 变量值: bh2Ry58My0NWFw==

Then , modify your Custom HTML tag to look like 然后 ,修改您的自定义HTML标记,使其看起来像

<script>
 _dAutomationGtmAddTimer("mysite.com", "{{API key}}", {"cmp1": 
 visitorContactInfo[0], "cmp2": visitorContactInfo[1], "cart_data":[{"amount":orderFormProducts[quantity],"id":orderFormProducts[sku],"image":"","link":"URL produto","name":orderFormProducts[name],"description":"","unitary_value":orderFormProducts[sellingPrice]}]})
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM