Setting Up Facebook Pixel Using Google Tag Manager

What is Facebook Pixel?

Simply put, Facebook Pixel is a tool that enables you to measure the effectiveness of your advertising by understanding the actions people take on your website. For each Facebook ad account, you can easily set up and create a Facebook Pixel using the Google Tag Manager.

It brings the following benefits:

  • Capturing site visitor data
  • Build retargeting lists
  • Track standard & custom events & conversions
  • Build lookalike audiences (audience expansions)
  • Provide people-based reporting through Facebook Analytics

 

Why should you use the Facebook Pixel?

  • Qualified Audience Expansion – It allows you to expand your reach outside of your particular audience targets by building lookalike audiences off specific site visitors or visitors that converted in the past.
  • Custom conversion tracking – Enables you to create predefined standard conversions, i.e., leads or purchases or generate any custom conversion that is a crucial action to track.
  • Retargeting – Retargeting when executed correctly can be a powerful tactic to close sales, drive leads or have a user complete a specific action.
  • Facebook Pixel Analytics – The Facebook pixel gives you people-based attribution insights based on users that visited your site.

 

How To Install The Facebook Pixel via Google Tag Manager: Step by Step

 

To successfully install the Facebook Pixel you will need to take the following steps:

  • Create the Facebook Pixel
  • Create a custom HTML Tag in the Google Tag Manager
  • Deploy the Facebook Pixel via GTM
  • Send test traffic to for validation
  • Create Standard events
  • Create Custom events
  • Ok, so let’s get started.

 

To set up the Facebook pixel expand the top left menu in the Ads Manager and click Pixels.

facebook pixel menu

Facebook Ads Manager

Click set up a new pixel and select “Manually Install the Code Yourself”.

Facebook Pixel Set Up

Note: In case you are collecting site visitor email, zip or phone number you can use Advanced Matching.

 

Advanced Matching passes these fields as hashed values to the Facebook pixel for improved people matching.

facebook pixel setup

Facebook Advanced Matching

Move right to the second step and copy the Facebook pixel.

facebook pixel advanced matching

Facebook Pixel Set Up

Google Tag Manager Set Up

In the Tag Manager under Tags click New

google tag manager new tag

Google Tag Manager

Under Tag Configuration select Custom HTML

choose html tag

Custom HTML Tag

Paste the pixel you copied earlier into the HTML tag. You can remove the static pixel since no script tags will not fire within an HTML tag.

copy facebook base code

Facebook Static Pixel

Note: If you want to install the static pixel for Javascript disabled browsers you can create a custom image tag that has a trigger set to only fire on javascript disabled browsers.

Set the Pixel to fire on all pages give it a descriptive name and click save

gtm add a trigger

Facebook Custom HTML Tag

Now that the pixel is set up go back to Facebook Ads Manager and paste in your website URL to send test traffic to your pixel.

send text pixel

Facebook Pixel Test Traffic

If everything looks good click continue.

Setting up the Facebook Pixel Event Via Google Tag Manager

Facebook provides nine standard events with predefined parameters associated with each one.

In this case, I am going to cover setting up a Facebook Standard Event (Purchase) and a Custom Event using the Google Tag Manager.

create a purchase event

Facebook Standard Events

After having verified the pixel installation, you should see the next step with an option to select an event you would like to track.

choose standard event

Facebook Purchase Event

Once you have selected the Purchase Event, we need to pass information to at least three variables dynamically.

Conversion Value – Total transaction value

Currency – Transaction currency

Content ID – You can pass transaction ID or product IDs. For dynamic product ads, the product IDs would have to match your catalog feed IDs.

send event parameters

Facebook Event Dynamic Values

Now that the dynamic variables are defined, the code for the purchase event can be added to the confirmation or thank you page.

The easiest way to do this is by creating a custom HTML tag in the GTM. (The same way we set up the Facebook Pixel using Google Tag Manager).

Creating a Custom Event

To create a custom event, copy the code that was used to generate the product event.

Give your conversion a name that clearly defines it.

 

<script>// Custom Conversion

// You can call the custom conversion anything you want

fbq(‘track’, ‘Trial_Signup’);</script>

 

Now that the conversion has been defined you can add the code for the purchase event by creating a custom HTML tag that fires when the key action has been taken, i.e., submission using GTM.

 

Note: Since you will be just starting data collection there won’t be any substantial conversion volume that Facebook can reference to optimize conversion objective campaigns.

 

To avoid getting stuck in ‘learning’ create a ‘soft conversion’ such as a PageView event.

Then you can temporarily set this as the focus conversion until you have collected enough data.

Creating a Custom Conversions (From Your Custom Event)

By default, Facebook does not make a custom event outside of the nine standard events available to leverage as the primary conversion objective.

In order or you to optimize against a custom event, you will need to first create a custom conversion off of a custom event.

Go to Custom Conversions

mega menu custom conversion

Facebook Custom Conversions

Click create custom conversions and then select the desired custom event.

pick event

Facebook Create Custom Conversion

Conclusion

Now that the set up of the Facebook pixel using Google Tag Manager is complete, your value extends much further than merely retargeting.

This allows you to maximize conversion objectives, expand your audience reach and gain attribution insights directly inside of Facebook.

Leave a Reply

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