Recently, we worked with a client who asked us, “Can I install multiple Facebook Pixels on my website?”
The short answer is yes, you can!
The Facebook Pixel is a popular tool that you may already be using to send data to Facebook Ads. This data helps you implement retargeting, conversion tracking, and audience segmentation.
However, depending on your tracking and marketing goals, you may want two (or more!) pixels running on one site.
Why would you use more than one Facebook Pixel? And how do you correctly install them?
Here are the basic steps covered in this guide:
- Find your Facebook pixel code
- Add this to GTM
- Modify your base pixel to initiate 2 pixels
- Configure track calls in separate tags
We’ll discuss all that and more in this quick tutorial. Let’s dive in!
Why Install Two Facebook Pixels on the Same Website?
There may be special cases where you need to place two tracking pixel codes on a single website and send data to two (or more) Facebook Ad accounts.
- A partner you are working with would also like to receive data to build custom audiences or do their own conversion tracking separate from yours
- Your website serves two or more audience types (or you have multiple product niches) and you want your pixels to track them separately without influencing each other
- You have multiple Facebook Ads accounts based in different countries that you would like to keep separate for retargeting or conversion tracking (this is similar to Rollup-Tracking setup in Google Analytics)
In any of these scenarios, it’s a good idea to have multiple Facebook Pixels to keep your tracking separate. There are other possibilities, too—just about any setup with more than one Facebook Ads account is a good reason to use multiple Facebook Pixels.
The Solution: Add Two Init Calls
To make this happen, you simply need to add another line of code to your existing Facebook Pixel code (the one that loads the library) to initiate another Pixel.
Step by Step – Facebook Pageview Tracking for Two Facebook Pixels
For this tracking deployment, we need to set up one Base Pixel code as well as our Event tracking calls. We won’t need to duplicate any codes, just modify our Base Pixel.
Let’s get started!
1. Find your Facebook Pixel Code
First, you need to navigate to your Facebook Pixel settings and retrieve the tracking code.
Once in your Facebook Ads account, click on the Business Tools menu and select Events Manager. On this page, you’ll find your pixels under your Data Sources.
Select one of the pixels you want to implement on your site and click Setup. You should see your Base Pixel code (it’s pretty big). Copy the code.
2. Create your Base Pixel Library code inside of Google Tag Manager
In Google Tag Manager, we’ll use the Custom HTML Tag type (although Simo Ahava also has a great Tag template that you can use) to implement our code.
So let’s head over to our Tag section in GTM, click on New and name our tag Fb – Base Pixel – All Pages. Then click on the configuration and in the side menu choose the Custom HTML Tag type.
Now you can go ahead and paste your Base Pixel into the Custom HTML field.
I recommend making 3 modifications to this code:
- Delete the track call fbq(‘track’, ‘Pageview’). We will separate our track calls from the actual Library code ourselves.
- Set Tag Firing Priority to 100 (located under Advanced Settings). We set this to ensure the Base Code fires before any track calls we implement later on.
Lastly, attach an All Pages trigger to your Tag to fire on every pageview. This will load the library on every page.
3. Modifying the Facebook Base Pixel to Initiate Two Facebook Pixels
With these settings, we followed the standard path of installing the Facebook Base Pixel code and preparing our data to be sent to just one Pixel. So how do we modify it to initiate another Facebook Pixel?
Easy. Do you see this line in the code?
This initiates our Facebook Pixel and configures where our tracking data should be sent (according to the Facebook for Developers page).
In order to send our data to two destinations, we can simply duplicate that line of code and insert the pixel ID from our second account. The result should look like this:
This should initiate our Facebook Pixel twice and make sure our track calls are sent to both destinations.
Save this tag and let’s move on.
🚨 Note: To build a higher-quality audience in Facebook Ads, you can delay Facebook Pixel and eliminate bounced users from it.
4. Configure Your Track Calls in Separate Tags
So far, our implementation doesn’t do much. It initiates the pixel but doesn’t send any data.
So in this last step, we’ll configure our track calls. This is the actual tracking data you want to send to Facebook.
Since we want to send these off separately from our Base Pixel code, we actually don’t have to repeat the large Base Pixel code over and over again for our different track calls.
To create the easiest form of track call, let’s send a generic pageview call to Facebook. For that, we’ll create a new Tag and name it Facebook – Pageview – All Pages. As the Tag type, we once again choose Custom HTML.
Remember that line we deleted earlier? Well, we actually want to use it here. Don’t worry, I’ve saved it for you:
Let’s paste this into our custom HTML window. This will send a pageview over to our Facebook Ads accounts.
All we need to do now is add our All Pages trigger and we are done.
What about Tag firing priority? We don’t really need to worry about this for our event Tags. Our Base Pixel has a higher Tag firing priority than our track call, which is 0 by default. Therefore, our Base Pixel Tag will always fire first and initiate the Pixel code, so we should be all set.
Let’s save this Tag and pat ourselves on the back for a successful Tag setup.
You can repeat this process for any other interactions you want to track. Facebook has a whole line of standard events that you can send into the tool. For more on tracking events with the Facebook Pixel in Google Tag Manager, check out our complete training guide.
5. Test and Preview Your Implementation
To complete your implementation, we have to test if everything works.
Let’s put our GTM container into Preview Mode (by clicking the large Preview button in the top navigation) and head back to our site. Be sure to refresh the page.
Once the Preview Panel (at the bottom of our page) appears, make sure you see that two tags have fired.
If these fired correctly, we should also be able to see the results in the Pixel Helper Chrome Extension. A closer view reveals that our data was sent to two Pixels. Success!
It’s even better to triple-check, so let’s enter Facebook’s testing mode. For this, you need to go back to your first Facebook Pixel settings page in your Facebook Ads account. Click on Test Events.
If you refresh the page for the website you are tracking, you should see your event being recorded. Everything works as expected.
If you repeat this step in your second Facebook Ads pixel account, you should see similar results.
If you want to see this post in video form with a bit more explanation, then check out our Premium Video content inside of MeasureMasters.
In this post, I’ve shown you how you can fire multiple Facebook Pixels on the same pageview. By using multiple pixels, you’re able to send data to multiple accounts at once without having to re-implement any code.
By adding another init call, you can initialize another tracker right in the Facebook Pixel and it will automatically deploy your track calls to the destinations you have configured.
Just add this magic line as often as you need:
Have you set up something similar in your tracking configuration? What are some of your favorite applications for multiple pixels? Leave us a comment below!
If you enjoyed this post, you may also find our post How to block internal traffic for Facebook ads useful.