How to properly install the Facebook Ads Pixel on your website via Google Tag Manager

Many blog posts are explaining how you can install the Facebook Ads Pixel. Google and Facebook offer such documentation.


However, some of these blog posts miss the details that a marketer would need in the long run.


This is why Udit, the Head of Marketing at PitchGround, recorded a step-by-step tutorial to help you track your Facebook Ads conversions.

At the end of the video, he shares a quick hack to help you improve your audience targeting.

Some of us prefer to read, so I wanted to write a guide to help you correctly install your Facebook Ads pixel, especially for non-technical users. I added some details and explanations.

What is Facebook Pixel?

Shortly, the Facebook Pixel helps you track conversions (e.g., purchases, registration, leads, or whatever desired action) on your website.

A complete answer is:

The Facebook Pixel is a code (aka script) that you can install on HTML.

HTML is the language with which all the webpages are structured.

This pixel works like any other tracking pixel, such as Google Ads or Google Analytics. Their installation works pretty much the same.

This code that you only need to install once tracks what a user does on your website and application and can fire events.

An event is any action on your site; visiting a specific page, watching a video, spending a particular time on your website, etc.

How to install the Facebook pixel (and how you shouldn’t)

I would suggest you to never install the Facebook Ads pixel directly on your website code.

Instead, use Google Tag Manager, a free tool to install all the scripts for all the apps you will use from now.

If you want to use tools like Hotjar, Hubspot, Active Campaign, and all the apps you would like to install on your website, you would need to access your website code and install them.

While it is not hard, you or someone else may accidentally delete a line of code or install the script incorrectly, affecting your website.

I broke a website that way some years ago. And we couldn’t recover it.

Additionally, Google Tag Manager has many more advantages that make me wonder why some people don’t use it, especially when being free.

First, install Google Tag Manager.

I will show you how to install Google Tag Manager if using WordPress.

If you’re not a WordPress user, this set up will work pretty much the same. Website builders like Wix or Webflow make it even easier.

Heads up:

Unlike Udit on his tutorial, I won’t be using a plugin that you can use to paste scripts. In my experience, when you have scripts in these plugins and your source code, you or someone of your team my duplicate installations. Make sure to keep everything in one place.

Just as a rule of thumb, use as few plugins as possible on your WordPress website.

I will log into my WordPress website:

If you don’t know how to access the login of your WordPress website, type your domain with the URL path w”p-login.php”

Just like this one: example.com/wp-login.php

Then, go toAppearance and Editor.

You will access the source code of your website.

Before installing Google Tag Manager, make sure you do it on your currently active website theme.

Consider that when you switch a theme, you need to install all your scripts again; after all, every new theme is a different code. That’s another reason why Tag Manager is a great option.

Choose the header file.

All themes have different files. Yet, most, if not all, have a header file. If you cannot find it, then you should read your theme’s documentation.


You can tell if you see the header of your website if you see elements like these:

You don’t need to be a programmer, but I encourage you to know some HTML basics.

Optionally, I suggest you have a backup plugin in case you break something. It’s just good practice, and chances you break the code doing these installations are low (You don’t want to push your luck).

It is time to install Google Tag Manager here.

Go to Google, type “Google Tag Manager” and open the 1st organic result, or go to tagmanager.google.com.

Create a new account.

Now, fill your website details.

You can add any account name.

If you have a website, choose Web.

Just for the record, an account is different from a container. You ca

Now you will see the scripts you will paste on the WordPress editor.

The 1st one should be pasted just below the header. I will show you how it looks like.

As you see, the tag is installed right after the  <head> tag. Don’t do it within the tag like  <head (script here)> or you will break your site :D.

Now, install the 2nd script that goes right after the  <body> tag.

I wanted to highlight the  <body> tag as it may contain more characters. Make sure this tag closes with a >. Just below it, paste the 2nd Google Tag Manager script.

I also highlight the closing </head> to help you find the <body> tag; they always come close to each other.

In my case, the body tag was in the same header.php folder. In other WordPress themes you may find the initial body tag on another folder.

Now save changes by clicking on Update file.

If done properly, you won’t have to deal with your website’s source code ever again for installing new scripts.

How to know Google Tag Manager is installed properly?

On his video tutorial, Udit uses the debug mode on Google Tag Manager.

If you’re using Google Chrome, I suggest something better (yeah, I’m challenging my boss).

Install the Google Tag Assistant.

Once installed, you will see an icon like the blue one I’m showing you.

Now, go to your website on any page, ideally the homepage.

Click the icon and you will see Google Tag Assistant is inactive by default. Click on Enable.

You will see a success message.

Just refresh your page and click the icon again. Google Tag Assistant will show all the Google-related scripts that are firing on your website.

And you’re done!

Now we can install any script on our website.

By the way, if your script shows up in red, it means Google Tag Manager wasn’t installed correctly. Make sure you install the scripts right below the head and body tags.

Install the Facebook Pixel on Google Tag Manager

Go to Facebook Business Manager. You should be logged in with your personal Facebook account.

Add a new data source by clicking on Add New Data Source or Set up Pixel.

Choose a way to install the pixel. I’d suggest to do it manually by choosing Manually add pixel code to website.

Then copy the script to install the Facebook Pixel.

Go back to your Google Tag Manager account.

And click on Tags to add a New Tag.

Click on New.

Name your new script however you want. I suggest you to use a descriptive name to distinguish future scripts.

Now, choose a tag type. Click on Custom HTML.

Past the Facebook Ads Pixel in the HTML canvas.

You can omit the advanced settings.

Let’s choose a trigger. Here we will choose on what event we want our pixel to activate.

Choose the default option All pages.You may choose other events like waiting 10 seconds of a session or clicks on specific buttons. All pages is the most common one.

Check your draft and now you can publish the changes.

Add a name to the new version you will publish. A version is any changes you have done on Google Tag Manager. This feature will help you manage your versions and changes.

You may want to add a description so someone else of your team can know what has been done so far.

Finally, click on Submit and you will be done.

How to verify the Facebook pixel is correctly set up

Like Google Tag Assistant, there’s a Facebook Pixel helper extension.

You just need to visit your site and see if the extension detect your pixel.

Just for the PitchGround site it doesn’t only detects the pixel, but 32 events fired!

And you’re done

If you follow this guide, you will be able to track your website conversions from Facebook. And with Google Tag Manager, you can virtually install any app that uses a tracking code on your website without needing a developer.

Udit Goenka
Udit Goenka
Articles: 97