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 ?
I found the solution on this page actually.
https://productforums.google.com/d/msg/tag-manager/GIaDNascpYw/TNfoJApXBgAJ
Not sure why this is happening, but the 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}}');
}
This error generally means fbq('init', <pixel_id>)
is getting called more than once with the same pixel id.
Another answer found in the Google Forum:
"You have to check whether your Facebook Pixel code is only initialised once per page (and not per event). Go to the tag where your FB Pixel code is and open the advanced settings. Tag firing options -> Once per page (not event!)."
I was having the same issue in my shopify store but I researched and find out that Trackify fb pixel app is my option. I removed all previous pixels and events that I created in past (was experimenting) and install the app it helps creating multiple events and pixels
This error will only occur if you try to initialize a pixel ID more than once, so you need to check all of the JavaScript code loading on your site and find where the multiple calls to init
your pixel ID are coming from.
Key area to check is to right-click on your site and click "View page source." Then check all referenced JavaScript files and any GTM containers you are referencing. I've heard of developers including the Facebook pixel code both in the <head>
of the site and in a GTM container, which would cause this error.
If you're having trouble finding the two init
calls, one of the easiest ways to look for specific JavaScript code on a site is to use Chrome Developer Tools. Press F12 to open the tools, press Ctrl+Shift+F to open the search panel, then type fbq
or whatever you are looking for. It will go through the sources it has loaded for the site and look for that code.