HAMZA EL KHARRAZ

Meta pixel tracking with Google Tag Manager is a powerful way to track various actions and events on your website. By using GTM to implement meta pixel tracking, you can gain insights into how users interact with your website, which can help inform your marketing and optimization strategies.

Why set up Meta (Facebook) pixel?

If you’re running any form of advertising on social media platforms like Facebook, tracking your marketing efforts is crucial for optimizing your campaigns.

One of the most powerful tools for tracking and analyzing marketing data is Google Tag Manager. By using GTM, you can track user behavior, measure conversion rates, and gather valuable insights into your marketing performance.

How the meta pixel works?

The Facebook pixel is an essential JavaScript code that links your website with Facebook’s Business Manager. By installing the pixel on your site, you can unlock valuable insights into user behavior, such as how visitors navigate your site, which pages they visit, and what actions they take. 

The pixel also enables you to track conversions and optimize your Facebook ads for better performance. With Google Tag Manager, installing the Facebook pixel is a breeze. You can easily manage your Facebook tags alongside other marketing tags on your site, all from a single, user-friendly platform.

If you own an online yoga store, it is likely that many users who visit your website will not convert on their first visit. Instead, they may be in the consideration phase, where they are exploring their options and evaluating whether they need your products. This uncertainty can make it challenging to optimize your marketing efforts and maximize conversions.

By installing the Facebook pixel on your website, you can target your store visitors with ads on Facebook and Instagram, even after they leave your site. This is known as remarketing and is an incredibly effective way to drive conversions and improve your ROI.

How to configure the Meta pixel :

Requirements

  • You have a Meta business suite account linked to your Meta ads manager account.
  • You integrated Google Tag Manager (GTM) into your website.

Get the pixel ID from Meta business Manager

Open the Meta business suit manager and head to the events manager tab.   

Events-manager-connect-data-source
Business-manager-Events-manager-MD

Let’s create a new pixel and add it to our website. Select ‘Web’ as the data source and give the pixel a name.

Select the ‘Meta pixel only’ option and copy the pixel ID.

Meta-pixel-copy-code-screen-1

A word on Meta's conversion API (CAPI)

If you are using server-side GTM (SSGTM), configuring Facebook’s conversion API is recommended. After the iOS 14.5 update, iPhone users can opt-out of tracking by apps such as Facebook, causing a significant decline in ad performance. 

According to the latest data from analytics firm Flurry, a whopping 96% of iOS users who have updated to iOS 14.5 have opted not to be tracked. SSGTM can be a great countermeasure to these recent changes if you have the budget to host your data on your server.

Configure Meta pixel in Google Tag Manager

Facebook base Tag (PageView)

Now we need to set up Meta’s configuration tag in Google Tag Manager.   

Add the Meta ID as a constant in GTM

Saving the ID as a constant will save us the hassle of pasting it each time we create a new tag. Head to the variables section in your GTM account and create a new variable. Select the “Constant” variable.

Meta-Pixel-Article-Visuals-1
Create new tag

Go to the “Tags” section and create a new tag.

Select the Facebook tag from template gallery
GOOGLE-TAG-MANAGER-Choose-Meta-tag-from-comunity-gallery
Add the Meta pixel ID

Insert your Meta ID and name your tag. Make sure that the event name is indicating PageView.

GOOGLE-TAG-MANAGER-Add-Facebook-tag-ID
Select the trigger for Meta pixel

The configuration tag should fire on all pages.

Meta-pixel-Watch-Video-GTM-trigger
Test your tag

If the tag is displayed on you under the “Tags Fired” section, most likely it’s working correctly. 

Once you publish the tag, you will be able to see your data in your Meta suite in a few hours. 

Configuring Meta's conversion events

As is the case with Google Analytics, it’s possible to track events in Meta. These events are the various interactions that occur on your website, including but not limited to scrolls, page impressions, and clicks.

According to Meta’s official documentation, there are two types of events that can be distinguished:

  • Standard events: all events that are recognized by Meta fall into this category. They can be used to optimize conversions.  
  • Custom events: in case none of the available standard events don’t cover all your tracking needs, you can define your own events.

Standard Meta events

View content

A visitor lands on a specific page, like a product page or a blog post. 

Google Tag Manager configuration for ViewContent

We are going to create a tag to track visitors who land on the blog page. Let’s start by creating a new Facebook tag to track ViewContent.

Meta-pixel-ViewContent-tag

The link of our blog page will be the trigger for this event. 

Subscribe

A visitor Subscribes to your paid service. Think of a Netflix subscription as an example.  

Google Tag Manager configuration for Subscribe

Create a new tag for Subscribe.

Go to event name > standard and select Subscribe

Meta-pixel-Subscribe-GTM-object-properties

You can send extra information with the event. Let’s say you have multiple subscriptions on your website: ‘Basic’, ‘Business’, and ‘Pro’. Each subscription tier has a starting price of $30, $99, and $199, respectively.

You can send this data to Meta by using the “Object Properties” option in our Facebook tag template. All you need to do is fetch the information from your website’s code.

The best method to get this data is by using the data layer. Once the implementation is finished, you will have all the information you need in one place. For the example given above, it might look something like this:

To pull the object properties from the data layer, click on the “+” next to the value field of tier.

Meta-pixel-Subscribe-GTM-object-properties-2

We will create a data layer variable to get the value of tier.

Meta-pixel-Subscribe-GTM-Data-layer-variable-tier

Repeat this process as many times as needed to extract all the values from the data layer.

We can use the event name as a trigger for our event.

Meta-pixel-Subscribe-GTM-trigger-1024x576-1
Submit application

If you offer some sort of program, for example, online live classes, or a job offer, you can track the number of submitted applications.  

Google Tag Manager configuration for Submit application
Create a new tag for SubmitApplication.

Go to event name > standard and select SubmitApplication.

Meta-pixel-SubmitApplication-tag

Of course, you can send extra information with the tag. For example, let’s say you offer online classes on a wide range of subjects. You can send the class name and its price, among other details.

We can use the event name as a trigger for our event.

Meta-pixel-SubmitApplication-trigger-1
Start trial

With StartTrial event you can track the number of free trials for your software service for example.

Google Tag Manager configuration for StartTrial

Create a new tag for StartTrial.

Meta-pixel-StartTrial-GTM-tag
We can send extra information with this event like value and country.

 The event name will be the trigger for the event.

Meta-pixel-StartTrial-GTM-trigger
Search
With Search, you can create an audience based on the number of users who performed a search using the internal search engine on your website.
Google Tag Manager configuration for Search

Create a new tag for Search.

It might be useful to send the search term with this event.

 The event name will be the trigger for the event.

Meta-pixel-Search-GTM-trigger
Schedule
If users can book an appointment via your website, you can use Schedule to track the number of booked appointments.
Google Tag Manager configuration for Schedule

Create a new tag for Schedule.

Meta-pixel-Schedule-GTM-tag
You can optionally send bookingIdbookingDate, and bookingDuration with this event.

The event Schedule will be the trigger for the event.

Lead
You can use Lead to create a list of potential customers. A common scenario where this event is used is when a visitor fills out personal information to download an e-book or to receive a newsletter.
Google Tag Manager configuration for Lead

Create a new tag for Lead.

Meta-pixel-Lead-GTM-tag-1
Consider sending content_type to understand what is the best form to generate leads on your website (e-book, newsletter, etc.).

If you have multiple signup forms (each has a different downloadable resource), adding content_name will help you distinguish between them. 

The event Lead will be the trigger for the event.

Meta-Pixel-Article-Visuals
Contact

The Contact event can be triggered once the user submits a request on a “Contact us” form or if he clicks on a phone number on your page. 

Google Tag Manager configuration for Contact

Create a new tag for Contact.

Meta-pixel-Contact-GTM-tag

You can send content_type to distinguish between different mediums of contact available on your website (contact form, chatbot, phone call, etc.). 

The event Contact will be the trigger for the event.

Meta-pixel-Contact-GTM-trigger
Find Location

If you own a physical store, you might need to track the number of website visitors who search for your address via a map on the website. TheFindLocation event can be triggered each time a visitor user the map on your website or app to locate your physical store.

Google Tag Manager configuration for FindLocation

Create a new tag for FindLocation.

Meta-pixel-Find-Location-GTM-trigger

Adding the object property location to your data layer will help you distinguish between multiple stores, if you are managing more than one.

The event FindLocation will be the trigger for the event.

Meta-pixel-Find-Location-GTM-tag
Donate

The Donate event can be useful for tracking the number of clicks on a donate button on your website or app. This event can provide insights into the effectiveness of your donation call-to-action and help you measure the success of your fundraising efforts.

Google Tag Manager configuration for Donate

Create a new tag for Donate.

Meta-pixel-Donate-GTM-tag

Some essential piece of information to send along with this event is value and currency.

The event Donate will be the trigger for the event.

Meta-pixel-Donate-GTM-trigger

Meta standard ecommerce events

We will put ecommerce events in a distinct category, as these events form together a discrete funnel.  

Most ecommerce event include products data, so we will include a products or an items object (if you are using GA4 ecommerce schema) in the data layer for all ecommerce events.

Customize Product
If your website lets users customize products, you can send a CustomizeProduct event.
Google Tag Manager configuration for CustomizeProduct

Create a new tag for CustomizeProduct.

Meta-pixel-Customize-Product-GTM-tag
Enhanced ecommerce data layer example Universal Analytics (UA schema)
Unlike the rest of ecommerce events we are going to see, there is no mention of CustomizeProduct in Google’s enhanced ecommerce documentation.
If you already have some enhanced ecommerce events set up, you can follow the same structure for CustomizeProduct. The data layer might look like this:
Ecommerce data layer with Google Analytics (GA4) schema

If you are already using the GA4 ecommerce data schema, then your data layer will be slightly diffrent.

For instance, the GA4 version has some different key names, instead of working with products, the items object will contain all product data.

The event CustomizeProduct will be the trigger for the event.
Meta-pixel-Customize-Product-GTM-trigger
Add To Wishlist

When a user clicks on the ‘add to wishlist’ button on your website or app, you can track this action using a Wishlist event. This event can help you understand which products or items are most frequently added to wishlists and can inform your marketing and promotion strategies

Google Tag Manager configuration for AddToWishlist
Create a new tag for AddToWishlist.
Meta-pixel-Add-To-Wishlist-GTM-tag
Enhanced ecommerce data layer example Universal Analytics (UA schema)
AddToWishlist is not supported by the UA schema.
Ecommerce data layer example with Google Analytics (GA4) schema

The event AddToWishlist will be the trigger for the event.

Add To Cart

Each time a user click on an “Add to cart”, the event  AddToCart will be triggered.  

Google Tag Manager configuration for AddToCart

Create a new tag for AddToCart.

Meta-pixel-Add-To-Cart-GTM-tag
Enhanced ecommerce data layer example Universal Analytics (UA schema)
Ecommerce data layer example with Google Analytics (GA4) schema

The event AddToCart will be the trigger for the event.

Meta-pixel-Add-To-Cart-GTM-trigger
Initiate Checkout

When a visitor clicks on a checkout button and heads to the checkout page on your website or app, you can track this action using a Checkout event. This event can help you understand how many visitors initiate the checkout process and can provide insights into where users may be dropping off during the checkout flow.

Google Tag Manager configuration for InitiateCheckout

Create a new tag for InitiateCheckout.

Meta-pixel-Initiate-Checkout-GTM-tag
Enhanced ecommerce data layer example Universal Analytics (UA schema)

Using the enhanced ecommerce model, the event eec.checkout will be the trigger for the event.

Ecommerce data layer example with Google Analytics (GA4) schema

The event begin_checkout will be the trigger for the event.

Meta-pixel-Initiate-Checkout-GTM-trigger
Add payment info

The visitor saves his payment information. 

Google Tag Manager configuration for AddPaymentInfo

Create a new tag for AddPaymentInfo.

Meta-pixel-Add-Payement-Info-GTM-tag
Enhanced ecommerce data layer example Universal Analytics (UA schema)

Using the enhanced ecommerce model, the event eec.checkout will be the trigger for the event.

Ecommerce data layer example with Google Analytics (GA4) schema

Unlike in Universal Analytics (UA), the GA4 schema provides more details about the transaction due to the attribution limitations in GA4. To keep the data consistent, it is important to push the same data from one checkout step to another. This ensures that you have a complete view of the user’s journey and can better understand their behavior throughout the checkout process.

The event add_payment_info will be the trigger for the event.

Meta-pixel-Add-Payement-Info-GTM-tag_
Purchase

When a user completes the checkout process and their order is confirmed on your website or app, you can track this action using a Purchase event. This event allows you to capture important transactional data, such as order value and currency, as well as product and transaction IDs. By tracking this event, you can better understand the effectiveness of your ecommerce efforts and identify areas for improvement in your sales funnel

Google Tag Manager configuration for Purchase

Create a new tag for Purchase.

Meta-pixel-Purchase-GTM-tag-1
Enhanced ecommerce data layer example Universal Analytics (UA schema)

Using the enhanced ecommerce model, the event eec.purchase will be the trigger for the event.

Ecommerce data layer example with Google Analytics (GA4) schema

Unlike in UA, the GA4 schema has more details about the transaction because the attribution doesn’t work as well.  We need to keep pushing the same data from one checkout step to another in order to keep the data consistent. 

The event purchase will be the trigger for the event.

Meta-pixel-Purchase-GTM-trigger

Custom Meta events

Unlike standard events, you can tailor your tracking to your specific needs by using custom events. 

For some specific tracking needs, standard events may not be sufficient. In such cases, you can use custom events to track actions that are not covered by the default set of events. For example, if you want to target visitors who have viewed at least one video on your website, you can create a custom event to track this action. As of the date of writing, there is no standard event available for this specific action, making custom events a valuable tool for tailoring your tracking to your specific needs

To track this action, we need to choose the custom event option in the “Event” section of the Facebook template.

Meta-pixel-Watch-Video-GTM-tag-with-variables

We can send other data besides the number of video impressions. The video process, title, and duration can be helpful as well.

Meta-pixel-Watch-Video-GTM-trigger-1