如何修复重复的Facebook像素ID错误? [英] How to fix Duplicate Facebook pixel ID error?

查看:304
本文介绍了如何修复重复的Facebook像素ID错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

添加了像此处显示的那样的facebook像素 此处 现在出现错误:

Added facebook pixel like they showed here here Now getting an error:

fbevents.js:9 Facebook Pixel Error: Duplicate Pixel ID: some-pixel-id

不明白是什么原因导致此错误.即使当我从他们的示例中运行代码并从控制台中的html中删除了像素代码时,我也得到了相同的结果.

Cannot understand what causes this error. Even when I run the code from their example with removed pixel code from html in the console I get the same result.

任何人都知道这意味着什么以及如何解决此错误吗?

Anyone knows what that means and how to solve this error ?

推荐答案

我在页面.

这是因为每次发送事件时都会初始化代码 具有相同的像素ID.实际上初始化应该只发生 一次."

Its because everytime you send an event the code is initialized with the same pixel id. Actually initialization should happen only once."

此修复程序有效.您可以使用Facebook Pixel Helper作为Chrome中的扩展程序来进行验证.

This fix works. You can verify that by using the Facebook Pixel Helper as an extension in Chrome.

if(typeof fbq === 'undefined') {
    !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', '123123123213121');
    fbq('track', 'PageView');
    fbq('track', '{{fBPixelType}}');
  }
  else {
    fbq('track', '{{fBPixelType}}');
  }

这篇关于如何修复重复的Facebook像素ID错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆