How To Configure Facebook Conversion API For GTM Server Side Container
In this guide you will learn how to enable your Facebook Conversion API inside your Facebook Business Manager and connect to your GTM Server Side Container.
If you haven’t followed our guide yet on configuring your server side GTM container for Shopify then be sure to complete those steps first.
Step 1: Import Elevar Recipe Into Server Side GTM Container
Before you configure your Facebook Conversion API Settings, you need to import our pre-configured tags into your server side container.
You can download this inside your Elevar account under the Pre Built Tags section.
And then head to your server side container to import here:
There are three variables that you need to update that we cover in the next few steps.
- Facebook pixel ID
- CAPI token
- CAPI test event ID
You’ll get these values in the next step.
Step 2: Enable Facebook Conversion API Settings
Now head on over to your Facebook Business Manager to configure your conversion API.
Note: you need to be an admin on your business manager account in order to complete these steps.
Go to your Settings tab:
Then scroll down to the Conversion API section and click Set Up Manually:
Step 3: Generate Facebook Token for Conversion API
Now you’ll be shown a modal overlay that walks through your token generation. Select your pixel and when you get to this Generate Access Token screen then go ahead and generate a token.
Copy this token and head over to your server side GTM container.
Go to Variables > User Defined Variables > search for “Token” to find the Facebook Conversions API Token variable. Then paste your token into the variable.
Note: If you’ve already visited this conversion API settings page before then you might be taken to your Implementation tab that contains the same details. If you are on the implementation tab then scroll down to the token generation section:
Step 4: Generate Test Event Code for Conversion API
Now that you’ve copied your new token into your server side container variable it’s time to generate your test event code.
In the modal you will see two options:
- Send instructions to developer
- Implement yourself
Select the implement yourself option.
Now you’ll be taken to the implementation tab on your Facebook Events manager page.
Scroll down on this page until you hit the Test Events section.
Click on Launch Test Events.
This will then take you to the Test Events tab.
Click on the “Server” tab (it’s easy to overlook at first since you are defaulted to the Browser tab).
Copy your test ID shown in the image above.
Then head back to your server side container to paste into another variable.
Step 5: Update Your Facebook Pixel ID Variable
The last step is to update the Facebook Pixel variable with your Facebook pixel ID.
Inside of Facebook Business Manager head to your Overview tab and then copy your Pixel ID found here:
And then inside of your server side GTM container > variables > user defined variables, paste the value here:
You’ve completed all of the steps required to start sending test conversions to your Facebook Conversion API via Google Tag Manager.