我正在使用从 Facebook 获得的一些 Javascript 来执行“跟踪”像素。但是当我使用“Facebook Pixel Helper”查看是否一切正常时,它表明存在错误,并且像素被多次激活。它没有说明如何解决此类错误,甚至没有说明在哪里查看。我可以在 Facebook 的这段代码中进行哪些更改来防止这种多次触发?
<script>
(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
_fbq.push(['addPixelId', '368842449990820']);
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', 'PixelInitialized', {}]);
</script>
<noscript>
<img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=368842449990820&ev=PixelInitialized" />
</noscript>