Thereās MASSIVE confusion regarding to server side tracking. Many canāt comprehend that 3rd party tracking, aka āpaste thie script into your page, and be done with itā is finished. Itās ending. Ever since January 2024, Google has been slowly pushing out Chrome updates that STOP measuring if you use 3rd party scripts/tags on your page. They will FULLY STOP measuring it from H2, 2024 more info at the Official Google page right here <
Now setting up server side tracking with GTM and Facebook/Google Ads/etc is so confusing, that many people / devs / freelancers are taking advantage of this. When I asked how much it would cost for STAPEās very own team to implement a few events (pageview, and onButtonClick to fire ATC for Facebook) they quoted me $1200!!!! YES, thatās right TWELWE HUNDRED DOLLARS. like WHAT THE F!!!!!!
Now, if you try and go on Youtube and find tutorials on how to use server side tracking with Facebook or Google ads, you come across endless guides on how to set it up for WOOCOMMERCE, SHOPIFY and other ecom platformsā¦ BUT THERE IS NOTHING for Affiliate Marketers using LANDING PAGES, PRE LANDERS and the Like!
UNTIL NOW THAT IS. this guide will save you THOUSANDS, itās pure gold and shows you how to set up custom events so you can feed that sweet data to Facebook Ads! (The process is pretty much almost the same for Google Ads too)
- What is required to set up the Facebook Conversion API?
- How To Setup the Facebook Conversion API With GTM For Wordpress Using Stape.io
- Set up server Google Tag Manager container
- Setting Up The GTM Server Side Plugin In Wordpress
- Setting Up Server Side GA4
- Setting Up The Facebook Conversion API
- Testing The Setup
- How to Add Landing Page Clicks as a Conversion Event on Facebook Ads using GTM Server
What is required to set up the Facebook Conversion API?
To setup the Facebook Conversion API alongside Google Tag Managerās server-side container, you need to have the following:
- An active Facebook ad account that supports the Conversion API.
- An access token for the Facebook Conversion API.
- A Google Tag Manager account configured with a server-side container
Once you have all this, then all you need to do is follow the instructions below.
How To Setup the Facebook Conversion API With GTM For Wordpress Using Stape.io
You can easily set up Facebook conversion API for your Wordpress site or landing page using Stape.io.
With Stape, you get access to extensive solutions designed to simplify your server-side tracking setup for Google Tag Manager and Facebook Conversion API.
Set up server Google Tag Manager container
First go to you Google Tag Manager account, go to the Admin section and create a new Container:
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 1 Image25](https://cdn.statically.io/img/iamattila.b-cdn.net/wp-content/uploads/2024/04/image25.png)
Then enter a name for your server container, select Server as the type of container, and click the Create button.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 2 Image24](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image24.png)
Select the Manually provision tagging server option and copy the container configuration that you see. Save this configuration in a notepad as you will need it later.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 3 Image2](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image2.png)
Next you need to log in to your Stape.io account and click on Create Container.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 4 Image13](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image13-1024x297.png)
Enter a name for your container, paste the Container Configuration that you copied from your Google Tag Manager Container, select the server location and click Create Container.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 5 Image23](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image23.png)
You need to wait a few minutes for the server container to deploy. Refresh the page after about 5 minutes to update the status. If the setup was done correctly, you should see the status āRunning.ā
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 6 Image8](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image8.png)
Next we need to set up a tagging URL.
Here you can configure a URL using your own custom domain, or you can use your default URL that is hosted on Stape.io.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 7 Image4](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image4-1024x357.png)
If you choose to go with your own custom domain, you can add it by clicking on the Add custom domain button. Then youāll need to create a DNS record for the subdomain at your domain registrar.
For the DNS record, add these settings:
- Type: A
- Name: ss (or any other subdomain name you want)
- IPv4 address: IP address depends on the location of the servers. You can find the custom domain IP address in your stape.io account.
- TTL: Auto
- Proxy status: disable
After that, you need to add your tagging server URL to your GTM server container. To do this go to the Admin section and select Container Settings.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 8 Image7](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image7.png)
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 9 Image11](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image11.png)
Setting Up The GTM Server Side Plugin In Wordpress
Go to your wordpress dashboard, go to plugins and click Add New, search for the GTM Server Side plugin, then install and activate it.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 10 Image17](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image17.png)
Then open the plugin settings, and enter your Google Tag Manager ID, your tagging URL, and the Stape container identifier.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 11 Image12](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image12-1024x553.png)
Setting Up Server Side GA4
Within your Web Container in GTM create a new Google Tag and add your Tag ID (GA4 Measurement ID), and in the Configuration settings enter the following parameters:
- Name: server_container_url
- Value: Enter the URL youāve created
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 12 Image18](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image18.png)
Then add a trigger to the GA4 tag. Normally it should trigger on all page views.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 13 Image6](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image6.png)
You can set up a Google tag configuration settings variable to predefine Google Tag settings when using multiple Google Tags on your website. This saves you from manually adding settings for each tag.
These parameters can include settings like whether to send a page view event when a Google Tag triggers, setting UTM parameters and more.
Hereās a list of standard Google Tag parameters: https://support.google.com/tagmanager/answer/13438166
Next we need to set up the GA4 event. To do that you need to create a new tag and select Google Analytics: GA4 Event as the tag type, then enter your GA4 ID and the event name you want.
In our case it is going to be an Add To Cart event.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 14 Image29](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image29.png)
Next go to GTM Server Container, click Client and create a GA4 client and save it.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 15 Image1](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image1-1024x480.png)
Then create a new GA4 tag, in the event name section select the variable you want add_to_cart in our case,
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 16 Image15](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image15.png)
and add a custom trigger Client Name equals GA4.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 17 Image9](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image9.png)
Next open the Server container preview mode and make sure that you see GA4 requests, if yes publish.
Setting Up The Facebook Conversion API
A great thing about using Stape.io as your container is that it will map all standard Facebook events automatically. If there is a special event that stape canāt map, it will still record it as a custom event, so basically you donāt need to set up events manually.
Here are the standard events that Facebook supports:
- PageView
- AddPaymentInfo
- AddToCart
- AddToWishlist
- CompleteRegistration
- Contact
- CustomizeProduct
- Donate
- FindLocation
- InitiateCheckout
- Lead
- Purchase
- Schedule
- Search
- StartTrial
- SubmitApplication
- Subscribe
- ViewContent
To set this up, first you need to create a new Tag in your server container. Click add new tag, go to the community template gallery and add Facebook Conversion API Tag.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 18 Image20](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image20.png)
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 19 Image10](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image10.png)
In the tag settings select inherit from client, and then you need to enter your Facebook API Access Token, Pixel ID and Test ID.
To generate an API Access Token, open your Facebook Business Manager account, go to the Events Manager, Data Sources, and click settings.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 20 Image19](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image19.png)
Then scroll down and click Generate access token, and copy that.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 21 Image14](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image14.png)
Then copy your pixel ID and Test ID as well and go back to Google Tag Manager and fill out the requirements.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 22 Image27](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image27.png)
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 23 Image22](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image22.png)
and go back to Google Tag Manager and fill out the requirements, save and thatās it.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 24 Facebook conversion api](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image26.png)
You also need to add a trigger. Click triggers, create a custom trigger, select āāThis trigger fires on Some Eventsāā and set Client Name equals GA4.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 25 Image9 1](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image9-1.png)
and go back to Google Tag Manager and fill out the requirements, save and thatās it.
Testing The Setup
Open the debugger for both the web and server Google Tag Manager containers, and then navigate through your website. In the server GTM containerās debugger, you should observe requests associated with the Facebook Conversion API Tag.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 26 Image16](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image16-1024x521.png)
And of course you can test it using the Facebook Testing tool inside the business manager as well.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 27 Image28](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image28-1024x193.png)
How to Add Landing Page Clicks as a Conversion Event on Facebook Ads using GTM Server
Now that you know how to set up the Facebook Conversion API tracking with GTM, you can set up all kinds of custom triggers you like in GTM and fire them back to Facebook as conversions.
In this example we are going to fire conversions on landing page button clicks with Google Tag Manager.
So first you need to set up the Click Button trigger. In GTM go to Triggers and configure a new trigger.
Then select Click on All Elements
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 28 Image3](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image3-1024x471.png)
And then configure the trigger by selecting the āāsome clicksāā option. Now you can set up different conditions for the event to fire based on your landing page or funnel, but the easiest way is by choosing Click Text from the built-in variables list:
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 29 Image30](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image30-1024x453.png)
So this way you can simply enter the text on your button, and when someone clicks on that button this trigger will fire the event.
Next when the trigger is set up, you need to add a tag to it, to send the event back to the Facebook conversion API.
For this weāre going to create a GA4 tag with the conversion event we want to send, for example Add To Cart. (This will only work if you have already set up the Facebook Conversion API and the GA4 client like we did in the steps above)
So click tags, create a new tag and in the tag configuration select Google Analytics and GA4 Event.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 30 Image31](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image31-1024x442.png)
Then enter your GA measurement ID, the event name you want to send, and the Click Button Trigger you just created.
![How To Setup Facebook Conversion Api (Capi) Tracking Using Google Tag Manager Server &Amp; Web Containers 31 Image5](https://iamattila.b-cdn.net/wp-content/uploads/2024/04/image5-1024x583.png)
Click save and thatās it. Now you can go back and test it the same way we did above.
This way you can easily set up custom triggers for CTA buttons, or any buttons on your landing page, and fire conversion events on Facebook Ads.