How to add a Facebook Conversion Pixels through Google Tag Manager

Facebook Pixel in Google Tag Manager

The right way to implement Facebook Pixel through Google Tag Manager

Facebook Conversions Pixels are great tools not just to monitor website or mobile apps conversions – those can also be controlled through after tagging URLs – but they are also one of the tools needed to optimise campaigns (e.g. cost per conversion) or to build Lookalike audiences (see image below) that tend to reduce your spending on Facebook advertising by creating target audiences made of users whose interests are similar to the ones of whoever has already reached a goal relevant to your business. On average I have noticed a conversion rate always higher than other generic audiences, sometimes even double.

Facebook Lookalike Audiences

To implement Facebook Conversion Pixels (FBCP) you have to create it for a particular Ads account activated in your site and populated with users info (it is said that you need at least 100 conversions to build a lookalike audience list). Once created it can be shared with other Ads Accounts and it can work for different Facebook Pages managed through the same Ads Accounts.

Google Tag Manager makes possible to add Conversion Pixels whenever and wherever you need, into any web page or mobile apps, depending on specific conditions. The Conversion Pixel has to be placed into the HEAD of your web page but, as you know, Google Tag Manager (GTM), has to be placed immediately after the opening BODY tag.

The question is: will Facebook Pixel works if implemented through a GTM Custom HTML tag?

The answer is yes! After implementing FBCP, you can check if it is working using the FB Pixel Helper, a free extension for Google Chrome.

Facebook Pixel inserted through Google Tag Manager is working (source: FB Pixel Helper, Google Chrome free extension)

Facebook Pixel inserted through Google Tag Manager is working (source: FB Pixel Helper, Google Chrome free extension)

NOTE – However, I have noticed that if “support for Document.Write” is not active for the HTML tag, the FB Pixel apparently takes longer to load – however, it still work – and the result is as follow:

GTM support document.write off

GTM support document.write off: FB Conversion Pixel takes too long to load

Commenta

12 replies
  1. Sam
    Sam says:

    In GTM do I need to also include a custom image tag for the Facebook pixel in addition to the Custom HTML tag for the Facebook script? I’ve done that and my chrome Facebook Pixel Helper now alerts me that pixel activated 2 times?

    Reply
  2. LWC
    LWC says:

    About “the question is”, Facebook never said it’s mandatory to add its pixel in the head.
    It’s just a recommendation. So what you do go against their recommendation. The question is therefore what are the downsides to your approach.

    Reply
  3. Cesare
    Cesare says:

    Hi Paolo,

    Very helpful site by the way. I have problems setting up conversion tracking for a lead with the new Facebook pixel and GTM. I went through some of your tutorials but I didn’t manage to find a solution.

    This is what I did:

    Tag 1: Facebook Base Code integrated with GTM on every page (see code below)

    Tag 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”

    FACEBOOK Base Code:

    !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”);

    CONVERSION TRACKING Code for the Lead:

    fbq(‘track’, ‘Lead’);

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

    I also tried to remove the:

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

    Thanks a lot.

    Cheers,

    Cesare

    Reply

Trackbacks & Pingbacks

    Leave a Reply

    Want to join the discussion?
    Feel free to contribute!

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    This site uses Akismet to reduce spam. Learn how your comment data is processed.