gpt4 book ai didi

javascript - 多个 Facebook 像素,像素助手中的错误

转载 作者:行者123 更新时间:2023-11-29 21:30:36 25 4
gpt4 key购买 nike

在使用新像素事件跟踪转化时,我需要使用我们自己的像素以及我们客户的像素:fbq('track', 'Purchase', {value: '0.00', currency: 'SEK'}) ;

根据 pixel-helper 加载像素事件。但随后同一像素出现错误:“Facebook Pixel 未加载”

我可以忽略这些错误吗,因为像素事件似乎已经加载过一次。我附上了一张显示像素助手消息的图片。

这是我从像素助手那里得到的消息: Pixel Helper Messages

这是我在感谢页面的 head-tag 中使用的代码:

<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');

fbq('init', 'Pixel_ID_1');
fbq('track', "PageView");
fbq('track', 'Purchase', {value: '{{ subtotal_price | money_without_currency }}',currency: '{{ shop.currency }}'});

</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=Pixel_ID_1&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->


<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');

fbq('init', 'Pixel_ID_2');
fbq('track', 'Purchase', {value: '{{ subtotal_price | money_without_currency }}',currency: '{{ shop.currency }}'});</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=Pixel_ID_2&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code —>

最佳答案

初始化第二个像素调用 fbq('addPixelId', '0123456789'); 就在 fbq('init', '9876543210'); 之后我。

所以在代码中包含两个像素的正确方法应该是这样的:

<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');

fbq('init', 'Pixel_ID_1');
fbq('addPixelId', 'Pixel_ID_2');
fbq('track', "PageView");
fbq('track', 'Purchase', {value: '{{ subtotal_price | money_without_currency }}',currency: '{{ shop.currency }}'});

</script>
<noscript>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=Pixel_ID_1&ev=PageView&noscript=1"
/>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=Pixel_ID_2&ev=PageView&noscript=1"
/>

Checkout this question and answer as well

关于javascript - 多个 Facebook 像素,像素助手中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36571794/

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