Add Facebook Pixel to Google Tag Manager

How to add Facebook Pixel code to Google Tag Manager:

Before you begin make sure you've set up a Google Tag Manager account and added the GTM code to thewebconsole (read our helpful guide here). Access your Facebook for Developers account and generate the Facebook Pixel tracking code and ID. Follow the steps below:

  1. Open Google Tag Manager
  2. Select your website's container and click Add a new tag
  3. Give this tag a name and click Tag Configuration
  4. Click Custom HTML Tag
  5. In Facebook, navigate to your Facebook Pixel page
  6. Click Actions > View Pixel Code
  7. Copy the entire Pixel base code as seen here: https://i.imgur.com/JOKtrpE.png
  8. Back in Google Tag Manager, paste the code in the HTML container
  9. Click the Advanced Settings dropdown and select Once per page under Tag Firing Options
  10. Left click "Triggering" - if you see page view, select page view. Once the window loads back, left click on page view again and hover over the page view trigger under trigger configuration. Click the pencil and ensure all page views is selected.
  11. If you do not see the page view option, you can click Triggering and then the + in the top right next to the magnifying glass. Name your trigger and click Trigger Configuration. Select page view from the trigger type list and make sure all page views is selected under "This trigger fires on". Click Save.
  12. Click Save again and then Submit in the top right corner of your page. You will need to name your version release and possibly add some notes. This will then deploy the code onto your site, which can be checked using the Facebook Pixel Helper Chrome extension (available here). Note: these pixels will not be visible in the code in any other way.

Last Modified: 22 June 2022
In This Article