3 Ways to Add Facebook Pixel Code in Google Tag Manager
Is GTM your new found love? If so, you might be thinking of shifting all your tracking codes to GTM for one of the following reasons:
1. You find this to be the easiest way to manage tags
2. You are the kind of person who likes to be organized by having every code at one place to make tagging super manageable.
3. You have fallen in love at first sight with the GTM interface and want a long-term tagging relationship with it.
(As happens with all love at first sight relationships, you may find out the not so endearing features once the novelty wears off…but that’s another story).
Adding Facebook Pixel in GTM
Depending on your business requirements, there are many tags that you can add in the GTM; here we will look at the one you want to create for adding the Facebook Pixel to your website.
You can create the tag for the Facebook pixel in the three ways outlined below:
1. Adding Facebook Pixel with the HTML code
This is the simplest method. All you need to do is add the code of your Facebook pixel in GTM
But there is one caveat. How do you find the Facebook pixel code?
Since we are talking about migrating the existing code to GTM, you might find it a bit trickier to get hold of the code. But there’s a way to do it, just follow the steps below:
Go to Facebook events manager
From the left-hand side Data Source list, select the pixel whose code you need. The overview tab of the selected pixel will show the pixel Id.
To find out the code, click the Add Events button and from the drop-down menu, select ‘from a new website’
Now select ‘Install code manually’.
From the next screen Copy the code.
(Note: If you are creating a new pixel, Facebook will automatically take you to the options for installing code)
Adding Code to the Tag Manager
if you have more than one container in the GTM, select the one where you want to add the Facebook pixel.
In the workspace, click New Tag
Enter Name of the Tag
Click Tag Configuration
From choose tag type list, select Custom HTML
In the HTML field, enter the Facebook code you copied.
Click Trigger
Select All pages
Save and Submit to Publish the New version
2. Adding Facebook Pixel with Partner Integration
For many people, partner integration is the preferred method. It is by far the quickest method and can save some time if go for automatic event set up option.
Let’s dive in.
Follow the first three steps outlined in the first method, and instead of selecting install code manually, select partner integration.
A list of partners will pop up.
Select Google tag manager
Allow Facebook to access the Tag manager
Select the right account and the container where you want to place the tag
Follow the steps and finish setup
This method will automatically place the Facebook pixel code as the custom HTML code in the GTM.
3. Adding Facebook Pixel with Facebook Pixel Template
In the previous two methods, we added the Pixel code. In this method, we simply need to copy the pixel Id, and as you can see in the above diagram (in the first method), the Id is not difficult to find.
Adding Pixel id in the Google Tag manager
Click New tag in the workspace
Click Tag configuration
From the Choose Tag type list select Discover more tag types in the
Community Template Gallery
Search Facebook
Select Facebook pixel by Facebook incubator
Add it to workspace
Tag configuration screen will open up.
Add Facebook Id
Select a trigger
Save and submit to publish
The Facebook Pixel added via any of the above methods will add the basic ‘page view’ tag . To add more more Facebook tags, you can either use the event manager tool in Facebook or create the tags in GTM. However, it is better to place all your tags in the GTM since this the reason you decided to use GTM in the first place. No?