Monday, May 13, 2024
15
rated 0 times [  18] [ 3]  / answers: 1 / hits: 54428  / 8 Years ago, wed, march 30, 2016, 12:00:00

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


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

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 ?


More From » facebook-ads-api

 Answers
59

I found the solution on this page actually.




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




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}}');
}

[#62757] Monday, March 28, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kylanalis

Total Points: 438
Total Questions: 85
Total Answers: 102

Location: Barbados
Member since Sun, Nov 27, 2022
1 Year ago
kylanalis questions
Sat, Oct 2, 21, 00:00, 3 Years ago
Tue, Oct 13, 20, 00:00, 4 Years ago
Thu, Feb 13, 20, 00:00, 4 Years ago
Tue, Jan 7, 20, 00:00, 4 Years ago
;