The client's problem
We need to implement two separate Meta (Facebook) Pixels on our website, and I would like to check if you can help us resolve this setup properly.
Specifically, we need to ensure the following requirements are met:
- Dual Pixel Setup: Both Meta Pixels are installed and firing correctly across the site.
- Accurate Attribution & Data Separation: The conversion tracking and attribution must function independently for each Pixel.
For instance, when a sale is driven by Account A, the order/purchase event should be attributed solely to Account A and must not show up as a conversion in Account B.
Could you let us know if you have experience with this type of setup and if you can assist us with it?
If so, please feel free to share your proposed approach or any access requirements you might need from our end.
My solution
The best approach is to utilize server-side GTM and the Meta Conversions API (this approach not only ensures accurate data separation but also bypasses browser tracking prevention restrictions, which will distort your data if you use the naive approaches that most others will surely propose):
1
In Meta Ads Manager, for each ad, append a custom parameter (e.g., account) to the destination URL so that its value will be used to separate the data for ad accounts A and B.
2
In Meta Events Manager, for each ad account:
2.1. Copy the corresponding «dataset ID».
2.2. Generate an access token for the Meta Conversions API.
3
In the domain's DNS settings, create an A or AAAA record pointing a subdomain of the website's domain to the IP address of the server hosting the server-side GTM container: this is a vital step to bypass cookie restrictions imposed by tracking prevention in browsers.
4
In Google Tag Manager:
4.1. Configure a tag to store the value of the account URL parameter (§1) in a first-party cookie only when this parameter is present in the URL.
This tag must fire before the §4.2 tag (using «Tag Sequencing») to prevent a race condition.
4.2. Configure a transport tag (e.g., a «Google tag») to route data to the server-side GTM container.
4.3. Create a «1st Party Cookie» variable to read the value of the §4.1 cookie.
4.4. Add the §4.3 variable, as well as the variables containing visitor identifiers (_fbp, _fbc, the hashed email and phone number from the order form), to the event parameters of the §4.2 tag.
4.5. Create triggers that fire the §4.2 tag to send events to the server-side GTM container:
5
In the server-side GTM container:
5.1. Configure a «Client» to receive the §4 data.
5.2. Create an «Event Data» variable to read the ad account identifier (§4.3) passed in the event parameters (§4.4).
5.3. Add the «Conversions API Tag» template from the «Community Template Gallery» to the workspace.
5.4. Using the §5.3 template, create 2 tags (for ad accounts A and B), specifying the corresponding dataset IDs and access tokens (§2).
5.5. To each §5.4 tag, assign a «Custom Event» trigger for each of the §4.5 events.
These triggers must fire only when the value of the §5.2 variable equals the corresponding ad account identifier.