Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Duplicate Facebook pixel ID error?

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 ?

like image 918
Eugene Monakov Avatar asked Mar 30 '16 15:03

Eugene Monakov


People also ask

How do I fix Facebook pixel errors?

There could be an error in your pixel base code. If this is the case, you can try deleting the Facebook pixel code you've placed on your website and adding the code again.

How do I fix pixels activated multiple times?

Multiple Times Pixel Activation This should only occurs once upon page loading and is an error. Solution: If you are seeing this error make sure to send the pixel id and event once and upon page loading. If it is sent with different data custom data parameters, those parameters should be merged into single pixel event.

What is pixel error?

Description: "Pixel Error" refers to one or several pixels in a frame which do not display the correct captured information as the pixels surrounding them. Sometimes also referred to as a “Dead Pixel”.


1 Answers

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}}');   } 
like image 59
Zdenek Hatak Avatar answered Oct 03 '22 17:10

Zdenek Hatak