How To Implement Facebook Pixel Using Google Tag Manager

Rhett Lloyd
Nov 14, 2017
5 mins

implement-fb-pixel-using-gtm
Using Google Tag Manager (GTM) to help implement Facebook pixels will help you consistently and easily track conversion and events from your website, allowing you to prove the success (or failure) of your advertising while building valuable data inside of Facebook that can be used for future targeting.

What Is Facebook Pixel?

Facebook Pixel is an analytics tool that helps you measure the effectiveness of your Facebook marketing campaigns by understanding what users do on your site. The Facebook Pixel is just pixel code that you generate within your Facebook Ads Manager account. The default pixel will help you in three main areas:

  • Conversion tracking: Facebook pixel ties conversions on your site back to specific Facebook advertising users clicked through.
  • Optimization: After installation, you can set up automatic bidding to target people who are more likely to convert.
  • Remarketing: Create custom audiences based on groups of users who came from certain ads to remarket to

Event Tracking

Tying conversions back to your Facebook ads is not the only thing the Facebook Pixel can do. You can also track events – actions taken on your site – with the Facebook Pixel. To do this, you need to generate extra pixel code within Ads Manager. You can choose from a list of standard events Facebook provides for you, or create your own custom events that are based off URLs. For a complete description of Facebook Pixel events, check out this document written by Facebook.

This sounds pretty great, right? Let’s talk a bit about why you should use the Facebook Pixel before we begin our walk-through of how to get the Facebook Pixel code, and how we can use GTM to implement it.

Why Should You Use Facebook Pixel?

Facebook is a major social media platform that can drive a great deal of traffic to your website. By using the Facebook Pixel, you will collect insightful data regarding actions and conversions that result from Facebook traffic.

Just like in Google Analytics, we can use that data to:

  • Better justify our ad spend
  • Better target future people

Google Analytics is great, and through audiences and remarketing, we can target people around the web.
But it’s not the only platform. There will certainly be crossover, but Facebook can provide you with:

  • A completely new audience
  • Different experiences for promotions and ads that may perform differently

One of the great things about Facebook Pixel is that it can be implemented on your site in many different ways, especially with Google Tag Manager!

Using Google Tag Manager

Default Code

Our first step is to generate our default Facebook Pixel in the Facebook Events Manager interface. A popup window will appear when you create your pixel. You will be given a few options for how to implement your Facebook Pixel, and we want to choose the first option: Use an integration of tag manager.

Facebook Pixel Configuration: Implementation options

Modal popup window displaying options for how to implement the Facebook Pixel

Choose Google Tag Manager as your solution, and then you will be asked if you want to do a quick install, or manual install. You can choose to do a quick install, but for the purpose of this post, we will do a manual install. The next window will present us with instructions for implementing the base pixel code and any event code we wish to use. Copy the base code for use in GTM.

Facebook Pixel base code

Facebook Pixel base code in the configuration popup

Over in GTM, we will need to use a Custom HTML tag for our pixel code. Why are we using a Custom HTML tag you ask? Great question! While GTM has many built-in tags, there is not yet one for the Facebook Pixel! Therefore, we must resort to using the Custom HTML tag.

Paste the base pixel code into the tag, and name it, CU – Default Facebook Pixel. For our trigger, we will use the All Pages trigger, because we want our Facebook Pixel present on every page. This lets us know what pages users from Facebook viewed on our site. When you’re finished with the tag, it should look like this:

Default Facebook Pixel Tag

Finished Default Facebook Pixel Tag with All Pages Trigger

Event Code

For this next bit we need to go back to the popup we left open in the Facebook Events Manager interface, and get the pixel code for the event we want to track. You will have a few standard events to choose from, and a custom event that you can create on your own. The recommended add to cart event code comes with the value and currency variables, while the advanced version throws descriptive parameters such as, content_id and content_name (i.e. product ID and product name). You can choose from any three versions of this code, and customize it by adding extra parameters. Check out this document to get a detailed look at the different parameters available for your use.  Let’s say we want to track add to cart events on our site.

Continue: How To Implement Facebook Pixel Using Google Tag Manager | LunaMetrics

Related Blogs

Mobile Speed: Making the Most of Mobile Marketing

Saturday, 27 May 2017

Mobile marketing efforts can be impeded by a slow Mobile Site. Every second of improved load time on a mobile site increases conversion rate by up to 27%. Learn how to increase your Mobile Site speed.

Continue Reading...

How Does Local Citation Building Improve Your SEO?

Monday, 21 March 2022

Are you a small business owner looking to expand your market online? Perhaps, you’re trying to build awareness for your new brand? In either case, proper Search Engine Optimization (SEO) is essential for you. If when searching for certain keywords relevant to your content, your site doesn’t appear in the first few search results, then…

Continue Reading...

Get Your Business Suited for Success