• Jervis Koo

Installing Facebook Pixel using Google Tag Manager

Using Google Tag Manager (GTM) to install our Facebook pixel is a great way to easily and consistently track conversion and events on our website, enabling us to prove the success (or failure) of our digital marketing efforts. Having a Facebook Pixel also allows us to collect valuable data inside of Facebook that gives us the ability to analyse and build audiences for remarketing campaigns. This post will cover how we can implement the default (All Pages) Facebook pixel that fires on all the pages of our website. Before beginning, we will need to create a Facebook Pixel on our Business Manager account. Need help? Here's a post walking you through how to create your first Facebook Pixel. If you're looking to set up standard events (adding to cart, fill out a form, click on button) or custom events (download pdf, scroll depth, time spent on page), head over to this post to get started. There are a couple of ways we can implement Facebook pixel using GTM; using Facebook's partner integration or doing this manually using custom HTML.

Using Facebook Partner Integration

Using 'Partner Integration' directly on Facebook after creating a pixel is the quickest way to install our pixel. Less time spent on implementation means more time to dive into the data and discover valuable insight to optimise our campaigns!

After creating our Facebook Pixel in the Facebook Events Manager, a popup window will appear with two options on how we would like to install our Facebook Pixel: 'Manually' or by using 'Partner integration'.

Select 'Use a partner integration' and choose 'Google Tag Manager'

Follow the steps and we want to sign in using the email address our GTM account is linked to. Once we have completed all the steps, we will see the Facebook Pixel tag automatically installed on our Google Tag Manager account. Remember to test if the pixel is firing correctly on your website before publishing the GTM container! Using custom HTML If for some reason, we are unable to install our Facebook pixel using the partner integration, we can install the pixel manually using a Custom HTML tag on Google Tag Manager. After choosing to manually install our pixel on Facebook, we will be given the base code.

Copy the base code and head to our workspace in Google Tag Manager. We will be creating a new tag and selecting "Custom HTML' from the menu.

Paste the base code, hit save. Next, we will need to create a trigger so our Facebook Pixel fires on our website.

In the trigger configuration menu, select "Page View" and make sure "All page views" is selected before saving.

Event Code

We can also set up Facebook event codes that fire on specific events (user actions) such as filling out a form, clicking a specific button, or downloading content on our website using


Now that our default (All Pages) pixel tag has been configured and saved, the final step is to make sure they're firing on our website correctly. To test our tags, we will need to click on the preview button in the top right corner of the GTM interface.

Next, we want to head over to our website and check if our Facebook Pixel tag is firing correctly before publishing our container on GTM.

We can also use the Facebook Pixel Helper extension for Google Chrome to debug any issues we encounter with our pixel. The extension will tell us if there is a Facebook Pixel present on any page you visit and provide information such as the Facebook Pixel ID. When we navigate to a page on our website and click on the Facebook Pixel Helper extension, we should see this;

If we see our Facebook Pixel ID and pageView data, we're good to go! We can also navigate to different pages to make sure that the pixel is firing on all the pages on our website.

Final Thoughts

Leveraging Facebook Pixel allows us to create custom audiences based on users who came to our website from specific ads and also optimise our ads using automatic bidding to target those who are more likely to convert based on the pixel data as well as tying conversions back to our Facebook ads.