Properly setting up your Facebook Pixel is one of the most important tasks when advertising on Facebook. The pixel helps in measurement and optimizing your campaigns, as well as enabling Facebook to create highly relevant audiences for the business.
In most cases, setting up the pixel is straightforward (see the guide here) and you will only need to add relevant conversion actions along your funnel. But in some cases, advertisers might need to implement multiple pixels, which require a different setup.
Pro tip:
If you’re using Google Tag Manager with the Custom Template Tag for Facebook (by Simo Ahava), you’re in the clear
Who would need multiple pixels
A classic example for this can be a publisher that works with multiple advertisers. For example, a publisher in the field of Higher Education might want to give pixel access to a section of his site. So “Economics studies” section will have pixels for the publisher’s pixel Advertiser A, while the “Social studies” section might have pixels for the publisher and Advertiser B.
Another example can be with a large brand that works with multiple agencies, each requiring to fire different pixel on various sections of the site.
Both examples are from actual clients I’ve worked with.
The issue with multiple pixels
If all pixels on the site are tracking the same behaviors, then there’s no problem at all. But if some actions should be restricted only to some pixels, it can get messy.
Let’s understand why.
Say Agency A want to track a conversion with a Lead event, while Agency B wants to use a Custom Event called Step4.
The standard pixel setup would look something like this:
Agency A
<script>
...base code...
fbq('init', '1234567890');
fbq('track', 'Lead');
</script>
Agency B
<script>
...base code...
fbq('init', '9876543210');
fbq('trackCustom', 'Step4');
</script>
Loading these two scripts one after the other will result in the following events being triggered:
Pixel | PageView | Lead | Step4 |
---|---|---|---|
Agency A (1234567890) | 🗸 | 🗸 | 🗸 |
Agency B (9876543210) | 🗸 | 🗸 |
The Step4 event will trigger twice, firing on both pixels.
This is due to the fact that both pixels that loaded on the page will respond to the fbq(‘track’) function, so the data will be sent to both.
Sending data only to a specific pixel
The solution, introduced by Facebook in November 2017, is to instruct the fbq() function to only trigger a certain pixel ID for the specific action.
This new method, trackSingle and trackSingleCustom, works just like the standard track and trackCustom fbq() methods, but also takes a parameter for the pixel ID.
For example, a PageView tag in the new method will add the pixel ID right before the action.
fbq('trackSingle', '1234567890', 'PageView');
Going back to the previous example, with a simple update to the code, we can make sure that the right action is sent to the right pixel.
Agency A
<script>
...base code...
fbq('init', '1234567890');
fbq('trackSingle', '1234567890', 'Lead');
</script>
Agency B
<script>
...base code...
fbq('init', '9876543210');
fbq('trackSingleCustom', '9876543210', 'Step4');
</script>
Pixel | PageView | Lead | Step4 |
---|---|---|---|
Agency A (1234567890) | 🗸 | 🗸 | |
Agency B (9876543210) | 🗸 | 🗸 |
The Step4 event will trigger once, only for the pixel defined.
One Response
Very clear explanation and easy to understand! Kudos to you Yan Kotliarsky!