Marketing

Install a Facebook Pixel using Google Tag Manager

By Jon Elordi

The Facebook Pixel is Facebook’s most powerful tool, and to get the most out of your Facebook marketing campaigns, you should have the Facebook Pixel installed on your site. This article will review how to install a Facebook Pixel using Google Tag Manager.

If not the most powerful, Facebook is one of the most powerful digital advertising tools available to your business. It can help your business drive traffic, sales, or leads to your site. Whatever your only brand needs, Facebook can likely help it in some way. One reason why Facebook is such a powerful tool is that it’s very good at tracking users. It knows how its users operate, and they use this information to assist in your marketing goals.

And you can boost this performance by adding the Facebook Pixel to your site. The Facebook pixel is a snippet of code that you implement on your website. Once you do, Facebook will then be able to see how its users interact with your website. This information allows the Facebook algorithm to optimize your ads for activity on your site.

The Facebook Pixel

The pixel is a small chunk of code on your website that sends tracking information about your users to Meta. This tracking code lets marketers target users who have been on their site or have completed some action on their site.

Additionally, the pixel allows you to create events. These can be something as simple as a button click or a purchase. Any conversion on your site can and should be a Meta event. Why? Because you can use Meta’s powerful algorithm to make campaigns that optimize for that event. Meta’s Conversion Campaign is one of its most powerful tools and one that can almost certainly help your business. We can install a Facebook Pixel using Google Tag Manager.

Google Tag Manager

Google Tag Manager is a free tool developed by Google. Google Tag Manager allows you to go one step further than Google Analytics(Another free Google Tool) by letting you track the actions people take on your site. Google Analytics, especially Google Analytics 4, already tracks some events, but if you want a more specific event tracked, Google Tag Manager is the tool.

At its simplest, Google Tag Manager consists of Triggers and Tags.

Triggers are predefined events that activate when a person does that event. Common triggers are button clicks, form completions, scroll depth, video views, etc. Most actions taken by a user on your site can be set as a trigger. Tags pieces of data that send information to Google Analytics, but in this case, Meta about what just happened on your site. So say you wanted to track how often someone fills out a contact form on your site. You would set up a trigger when someone clicks “submit” on the form. And that would fire the tag with information like form name, URL, time, date, and any other predetermined data to Google Analytics or Meta to use in tracking.

This is a brief overview of one way to use Google Tag Manager. Google Tag Manager is a very powerful tool that I would encourage you to familiarize yourself with.

If you have a WordPress site and need to install Google Tag Manager, I recommend the Site Kit plugin by Google. It streamlines the process and makes everything super simple. You can also install Google Tag Manager by inserting code on the pages of your site.

How to install a Facebook Pixel using Google Tag Manager

The first thing you’ll want to do is get your Facebook Pixel ID. In Facebook Ad Manager, click on the menu option and go to the “Events Manager” section.

Facebook Events manager

In Events Manager, you should see your pixel. If not, create a pixel by clicking on the green “Create Data Sources.” You’ll need to fill out a few quick prompts, then you’ll have your pixel. Once you locate your pixel save the Pixel ID. You’ll need that to configure your Google Tag Manager set up.

Facebook Pixel ID

At this point, you should go to your Google Tag Manager account. Navigate to the Tags section and then click “New.”

Create a Google Tag Manager Tag

A window should slide in. You’ll create your Google Tag Manager tag with the Facebook Pixel data in this window. Make sure you give the tag a name. For this example, I named the tag: Example Facebook Pixel. Then click on “Tag Configuration” and select “Custom HTML.”

Custom HTML Facebook Pixel

From here you will need to input your Facebook Pixel code, which is below. Make sure you swap out the ENTER-YOUR-ID portion of the code with the Facebook Pixel ID you saved from earlier.

<!– Facebook Pixel Code –>
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version=’2.0′;
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,’script’,
‘<https://connect.facebook.net/en_US/fbevents.js’>);
fbq(‘init’, ‘ENTER-YOUR-ID’);
</script>
<!– End Facebook Pixel Code –>

Also, make sure you click on “Advanced Settings” and set your “Tag Firing Priority” to 100. Your Google Tag Manager tag should look something like this:

Google Tag Manager Custom HTML for Facebook Pixel

Now we need to set up the trigger. A trigger in Google Tag Manager is what tells Google Tag Manager to fire a tag. A tag without a trigger will just sit there and do nothing. You need to set a trigger for however often you want the tag to send data. In this case, we want th tag to fire on every pageview.

To do that, click “Triggering” and select “All Pages” from the slide-in options.

Google Tag Manager Trigger

Click Save.

There you have it you created your Facebook Pixel Tag and Trigger. However, you’re not done. You still need to create another tag and trigger to send data to Facebook about the events that are happening on your page.

You’re going to go through this whole process again, but this time you’ll be using different code. If you’re curious about setting up more custom Facebook Events, you can read our guide on creating custom meta events. The code you need to install is right here:

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

The “Trigger” for this tag is the same as before: “All Pages.”

You’ve now created two Google Tag Manager tags and have assigned both of them the “All Pages” trigger. All that’s left to do now is publish the changes to your site. Do that by clicking the “Submit” button on the top right.

Need Assistance With The Installation?

Implementing the Facebook pixel on your website is a must to get the most out of Facebook. If you need any help or have questions about implementing a Facebook pixel on your website, we at Aqueduct Marketing can help you with that and help you track more advanced things like sales or conversions.