Get Started Get Started

Setting Up the Meta Pixel via Google Tag Manager (GTM)

The Meta Pixel is a piece of code on your website that helps you measure how well your Meta ads work, by tracking the actions people take on your website. This article explains how to create a Meta Pixel and install it through Google Tag Manager.

Alternatively, you can add the pixel directly to your website design. See Setting Up the Meta Pixel Manually. 

Before getting started, make sure you have:

Note: If the Meta Pixel code is already in your website design, remove it from the design first, so the pixel does not load twice.

Create the Meta Pixel

  • Sign in to Meta Business Suite.
  • Open Events Manager from the Meta Business Suite menu.
  • Click Connect Data in the left menu.
  • Select Web.
  • Enter a name for your pixel.
  • Click Next.
  • Select Install Code Manually.

Note: You do not need the pixel code for this method, as the Google Tag Manager template loads the pixel for you. If Meta shows more setup steps, you can close them.


Find Your Pixel ID

  • Click Data Sources in the left menu.
  • Select your pixel.
  • Open the Settings tab.
  • Copy the number under Dataset ID.

Meta now calls the Pixel ID the Dataset ID. They are the same number. Keep a copy of it, as you need it for the Meta Pixel tag and again when you set up e-commerce tracking.

Create the Meta Pixel Tag in Google Tag Manager

  • Log in to your Google Tag Manager account.
  • Select the container for your website.
  • Click Tags in the left menu.
  • Click New.
  • Enter Meta Pixel as the tag name.
  • Click Tag Configuration.
  • Click Discover more tag types in the Community Template Gallery.
  • Search for Meta Pixel.
  • Select the Meta Pixel template published by facebook.
  • Click Add to workspace.
  • Select Meta Pixel under the Custom tag types.

Configure the Event

  • Enter your Pixel ID in Facebook Pixel ID(s).
  • Under Event Name, select Standard.
  • Select PageView.

Assign the Trigger

  • Click Triggering.
  • Select All Pages.
  • Click Save.


Test the Tag

Before publishing your changes, check that the tag fires.

  • Click Preview in Google Tag Manager.
  • Enter your website URL.
  • Click Connect.
  • Check that Meta Pixel appears under Tags Fired.

Publish the Changes

Once the tag fires correctly:

  • Return to Google Tag Manager.
  • Click Submit.
  • Click Publish.

Finish the Setup in Meta

  • Return to the Set up a new pixel page in Meta.
  • Click Continue.
  • Turn Automatic Advanced Matching on or off, depending on your needs.
  • Click Continue.

Meta can take up to 24 hours to start collecting data. To check that the pixel is working, see Checking Your Meta Pixel with Meta Ads Data Advisor.

To send your orders to Meta, continue with Setting Up E-commerce Tracking for Meta Ads (GTM).