gpt4 book ai didi

google-analytics - 如何在Google Analytics(分析)增强型电子商务中转义撇号

转载 作者:行者123 更新时间:2023-12-03 17:28:20 25 4
gpt4 key购买 nike

带撇号的品牌没有出现在我的Google Analytics(分析)报告中。这是我的代码:

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-52143532-4', 'auto');
ga('require', 'ec');
ga('ec:addProduct', {
'id': 'pay-q39-instead-of-q90-fo', 'name': 'Pay Q39 instead of Q90 for haircut (2018-09-17)', 'category': 'Other',
'brand': 'The Barber's Shop', 'variant': 'male', 'price': '5.07' });
// Transaction level information is provided via an actionFieldObject.
ga('ec:setAction', 'detail'); ga('send', 'event', 'ecommerce', 'detail'); </script>


我尝试解决此问题的方法是使用以下代码,只需转义撇号即可:

带撇号的品牌没有出现在我的Google Analytics(分析)报告中。这是我的代码:

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-52143532-4', 'auto');
ga('require', 'ec');
ga('ec:addProduct', {
'id': 'pay-q39-instead-of-q90-fo', 'name': 'Pay Q39 instead of Q90 for haircut (2018-09-17)', 'category': 'Other',
'brand': 'The Barber\'s Shop', 'variant': 'male', 'price': '5.07' });
// Transaction level information is provided via an actionFieldObject.
ga('ec:setAction', 'detail'); ga('send', 'event', 'ecommerce', 'detail'); </script>


我只是使用 'brand': 'The Barber\'s Shop'而不是 'brand': 'The Barber's Shop'。但是,我仍然没有在Google Analytics(分析)中看到有关名称中带有撇号的品牌的数据。这是在Google Analytics(分析)中转义撇号的正确方法吗?谢谢。

更新1:如果Google Analytics(分析)不喜欢 'brand': 'The Barber\'s Shop'解决方案而不是 'brand': 'The Barber's Shop',那么我打算编写一些代码以完全删除撇号的外观,而改为使用 'brand': 'The Barbers Shop'。但是,如果Google Analytics(分析)无法以某种方式处理撇号,那会让我感到惊讶。

最佳答案

这听起来可能很愚蠢,但是您是否尝试过以下操作?

<script>
(function(i, s, o, g, r, a, m) {
i["GoogleAnalyticsObject"] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, "script", "//www.google-analytics.com/analytics.js", "ga");
ga("create", "UA-52143532-4", "auto");
ga("require", "ec");
ga("ec:addProduct", {
"id": "pay-q39-instead-of-q90-fo",
"name": "Pay Q39 instead of Q90 for haircut (2018-09-17)",
"category": "Other",
"brand": "The Barber's Shop",
"variant": "male",
"price": "5.07"
});
// Transaction level information is provided via an actionFieldObject.
ga("ec:setAction", "detail");
ga("send", "event", "ecommerce", "detail");
</script>


我用双引号替换了单引号,这应该避免造成混淆并“修复”问题。

关于google-analytics - 如何在Google Analytics(分析)增强型电子商务中转义撇号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52582653/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com