To mitigate some of the IOS updates’ negative impacts, Facebook recommends using the Facebook Conversion API (CAPI) along with your Facebook pixel.
“The Conversions API helps improve performance by sending data you already share with your pixel through an API connection, which is less impacted by ad blockers and browser connectivity issues. You can see how people interact with your business in ways the pixel alone can’t measure, like when purchases are initiated online but completed in a physical store.” – Source: Facebook
You should do two things to make your Facebook pixel more powerful:
#1 Manually feed your pixel with more conversion data.
Create a custom audience based on your customer list. Upload as much data as possible via the list.
You can use your shopping cart or CRM to get customers’ data. Make sure to supply conversion value.
Do this once every week to keep your custom audience up to date. Use this audience to create new lookalike audiences and then use them in your campaigns.
These new lookalike audiences are likely to be far more accurate than the one you have right now.
#2 Start using Facebook conversion API to collect server-based events.
Such events feed your pixel in the absence of corresponding browser-based events.
Facebook will prioritize Conversion API over Facebook Pixel.
Currently, browser-based events are prioritized to feed your Facebook ad pixel, and server-based events are used only in the absence of corresponding browser-based events.
But starting next year (2023), Facebook will prioritize Conversion API over Facebook Pixel.
That means that server-based events will be prioritized to feed your Facebook ad pixel, and browser-based events will be used only in the absence of corresponding server-based events.
What is required to set up the Facebook Conversion API?
How Facebook Conversion API works with Server Side GTM Container?
#1: When the user interacts with a website, a server request is made, and at the same time, the GA4 web tag fires on the client-side GTM container.
#2: This GA4 web tag then transports the data captured from the website (events, pageviews, variables) and passes it to the GA4 web client in the server-side container.
#3: Now, the GA4 web client request is processed in the server-side container, and the related parameters are passed to the individual third-party server tags like Google Analytics 4 and Facebook.
#4: Once the required parameter is received in the Facebook Conversion API Tag, the data is finally dispatched to the Facebook server.
Now that you know how the Facebook tag works on the server-side container, let’s jump to configure it.
Configuration of the client-side GTM container
You need to configure the client-side GTM container to send values from the website to the GA4 client in the server-side container.
Since in this article we will talk about setting up the Facebook Conversion API tag using the basic GA4 tag, we will focus on the additional data parameters set up, as below.
Updating general parameters
You may want to send many data parameters to Facebook, e.g. ‘Event Name’, ‘Page location’, ‘Event ID’ ‘, Ecommerce variables’, etc. We will configure those parameters first.
Note: I assume you have already created the required event tags, triggers, and variables in the client-side GTM container.
If you need more information about how to create variables and use them, you can find it here.
Along with general parameters, you may also like to pass a few user-related parameters to Facebook like ‘User Email Address’, ‘User City’, ‘User Phone Number’, etc.
But hold on, we will pass it to our server-side container and not to GA4 directly. We will filter out such variables in later steps.
Step-7: To add user-related data parameters, click on ‘User Properties‘ and then click on ‘Add Row’.
Step-8: Now, type the parameter field you want to add.
For example, I am adding ‘user_data.email_address’ and then clicking on the + button to select the variable.
Step-9: Select the ‘User email’ variable from the list.
And that’s it. Similarly, you can also add the following user-related variables.
user_data.phone_number
user_data.address.first_name
user_data.address.last_name
user_data.address.city
user_data.address.region
user_data.address.postal_code
user_data.address.country
Your final configuration may look like below
Updating custom data parameters
Along with general and user-related parameters, you can also pass custom data parameters such as ‘transaction_id’ ‘value’, ‘currency’, ‘ecommerce variables’, etc.
You can also pass facebook specific parameters like
x-fb-ud-ge: Hashed user gender
x-fb-ud-db: Hashed user date of birth
x-fb-ud-external_id: External ID, e.g. advertiser loyalty ID with recommended hashing
x-fb-ud-subscription_id: Subscription ID, no hashing needed
x-fb-ck-fbp: Facebook cookies
Once you have added all the required parameters, the configuration at the client-side GTM container is done, and you can save the tag.
Configuring server-side GA4 Tag (exclusion of Facebook parameters)
Since we do not want to pass any PII data to the GA4 account, we need to exclude it from the GA4 tag in the server-side container.
Follow the below steps to know more:
Step-1: Navigate to your server-side container, click on ‘Tags’, and then click on the GA4 configuration tag.
Step-2: In the tag configuration, click on ‘Events Parameters‘ and then click on ‘Add Row’ under ‘Parameters to Exclude’.
Step-3: Now add all parameters that contain user-related PII data and Facebook-specific parameters.
Note: If you don’t remember which parameters to exclude, you can put the server-side container in preview mode and generate a specific event. You will get all the information about the parameter name which needs to be excluded, like in the below image.
Step-4: Save the tag, and you are done with configuring the GA4 server-side tag.
Step-1: Navigate to your server-side container and click on ‘Templates’.
Step-2: Click on ‘Search Gallery’ under ‘Tag Templates’.
Step-3: Select ‘Facebook Conversion API Tag’ and add it to a workspace.
Step-4: Navigate to the ‘Tags’ tab and click on ‘New’.
Step-5: Give your tag a name like ‘Facebook Conversions API Tag’ and click on ‘Tag Configuration’.
Step-6: Now select the tag type as ‘Facebook Conversions API Tag’.
Step-7: Now add your Facebook Pixel ID and API Access Token code. You can type ‘Test1234’ in the ‘Test Event Code’ and select ‘Action Source’ as a website.
Step-8: Click on ‘Triggering’ to create a trigger for our tag.
Step-9: Now apply the below configuration to your trigger:
Trigger fires on ‘Some events’
Condition: Client Name ‘equals’ GA4.
Step-10: Save the tag, and you are done.
Preview and debug
Follow the below steps to preview and debug.
Step-1: Navigate to the server-side GTM container and click on ‘Preview’.
Step-2: A new window will open like the one below with a blank summary.
Step-3: Go to your website and perform the purchase event.
Once you do that, you should see that the purchase event is fired, like in the image below, and the Facebook Conversion API Tag has also fired.
Step-4: Now click on the ‘Request’ tab, and you should see the outgoing ‘HTTPS’ request to ‘https://graph.facebook.com/) with status code ‘200’.
If you click on the ‘Post-200’ status code, you will get more details like below.
Now navigate to the Facebook Event testing tool and click on ‘Test Events’. You should be able to see the purchase event just like below.
Congratulations!
You have successfully set up the Facebook Conversion API Tag using the server-side GTM container.
Note: Like this purchase event, you can send any event from your website to Facebook using the server-side GA4 client and the Facebook Conversion API Tag. Just keep in mind to exclude the PII-related parameters from the GA4 server-side tag and to hash the necessary parameters.
Frequently asked questions about GTM server-side tagging for Facebook tutorial.
Can you set up Facebook Events using a server-side GTM container?
Yes, server-side tagging is a new way to use Google Tag Manager (aka GTM) in Google’s cloud environment. Using the Facebook Conversion API Tag, you can use a GA4 (in a server-side environment) client to send events to Facebook.
You can use the below steps:
1. Configure client-side GTM container 2. Update general parameters 3. Update user data parameters 4. Update custom data parameters 5. Configure server-side GA4 Tag (exclusion of Facebook parameters) 6. Test the set-up 7. Configure Facebook Conversion API Tag 8. Preview and debug
What is the Facebook Conversion API?
The Facebook Conversion API allows you to send website events from the server-side GTM container to the Facebook Ads Manager or Events Manager.
The conversion API is linked to the pixel and processes the event request like normal browser events. You can use these event details for reporting and optimization.
What is the Facebook API Access Token?
To use Facebook Conversion API, you need an access token. The access token is passed as a parameter in each API call and allows the conversion API to process the request and send it to Facebook.
Register for the FREE TRAINING...
"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."
Here’s what we’re going to cover in this training…
#1 Why digital analytics is the key to online business success.
#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.
#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.
#4 Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.
#5 The number 1 reason why conversion optimization is not working for your business.
#6 How to advertise on any marketing platform for FREE with an unlimited budget.
#7 How to learn and master digital analytics and conversion optimization in record time.
My best selling books on Digital Analytics and Conversion Optimization
Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.
Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.
Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.
Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.
About the Author
Himanshu Sharma
Founder, OptimizeSmart.com
Over 15 years of experience in digital analytics and marketing
Author of four best-selling books on digital analytics and conversion optimization
Nominated for Digital Analytics Association Awards for Excellence
Runs one of the most popular blogs in the world on digital analytics
Consultant to countless small and big businesses over the decade
Get My Step-By-Step Blueprint For Finding The Best KPIs (32 pages ebook)
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.