Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Pixel Conversion Tracking GTM - Error: "Facebook Pixel pixel activated multiple times"

I have problems setting up conversion tracking for a lead with the new Facebook pixel and GTM.

This is what I did:

  1. Facebook Base Code integrated with GTM on every page (see code below)
  2. Custom Code for the Conversion Tracking (Lead) integrated with GTM when a particular form submit happens (see code below)

When a conversion happens the following error shows up on the Facebook Pixel Helper : “Facebook Pixel activated 2 times…Facebook Pixel pixel activated multiple times on this web page, which can cause errors in your event tracking”

enter image description here

FACEBOOK Base Code:

<!-- Facebook Pixel Code -->
<script>
!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','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '11111...');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=11111...&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->`

CONVERSION TRACKING Code for the Lead:

<script>fbq('track', 'Lead');</script>
<noscript>
    <img height="1" width="1" style="display:none"    src="https://www.facebook.com/tr?id=11111...&ev=Lead&noscript=1"/>
</noscript>

No idea where the problem is actually. Can you help?

I also tried to remove the:

<noscript>
    <img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=11111...&ev=Lead&noscript=1"/>
</noscript>`

but in this case the conversion wouldn’t be triggered at all.

like image 259
cesare Avatar asked Oct 31 '25 15:10

cesare


1 Answers

Keep two Custom HTML in total:

The first Custom HTML tag should contain the Facebook pixel base code as per your first example. Set it to fire on every page and change the setting to fire "Once per page".

The second Custom HTML tag should contain your Lead event as per below:

<script>
fbq('track', 'Lead');
</script>

Set this to fire "Once per Event" if you are firing it on an event such as a lead form submission, or "Once per Page" if you fire this tag on a page load such as a thank-you-page.

The trick is the to ensure that you change the sequencing setting for the second tag. On the lead event tag, set up the Facebook Base Tag to fire before the lead event tag does - this is likely currently the problem.

The lead event does not work if the facebook base pixel is not already loaded - currently they may be firing in the wrong order.

GTM example

Your 'noscript' snippets should be left out as they will not be fired anyways inside a Custom HTML tag. The 'noscript' snippets are actually there to help if javascript is broken or disabled in the browser, so if you want them to work within GTM you need to create a Custom Image tag inside GTM instead and add the noscript image URL there such as below:

GTM image tag example

Make sure that you don't have both options enabled at the same time as it will cause double-counting of conversions in the Facebook reporting. Instead set up a GTM criteria that checks whether javascript is enabled or not and fire the image tag only when it is not and you are golden.

These tricks should be credited to the amazing Jehoshua Choen of Analytics Ninja, so please read up on his whole post on the topic if you want further clarification.

like image 157
Henrik Söderlund Avatar answered Nov 02 '25 20:11

Henrik Söderlund



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!