How To Configure Facebook Conversion API in a GTM Server Side Container

In this guide you’ll learn how to enable the Facebook Conversion API inside Facebook Business Manager and connect to the GTM Server Side Container.

Step 1: Import Elevar Recipe Into a Server-Side GTM Container

Before configuring Facebook Conversion API Settings, you’ll need to import the pre-configured tags into the server side container.

You can download this inside your Elevar account under the Pre Built Tags section.

After this, go to your server side container to import:

facebook-capi-gtm-1

Next, you’ll need to update three variables:  

  1. Facebook pixel ID
  2. CAPI token
  3. CAPI test event ID

Step 2: Enable Facebook Conversion API Settings

Now go to your Facebook Business Manager to configure your conversion API.

Note: You’ll need to be an admin on your business manager account in order to complete these steps.

Go to your Settings tab:

facebook-capi-gtm-2

Then scroll down to the Conversion API section and click Set Up Manually:

facebook-capi-gtm-3

Step 3: Generate Facebook Token for Conversion API

Now you’ll be shown a modal overlay that walks through your token generation. Select the pixel and when you get to this Generate Access Token screen then go ahead and generate a token.

facebook-capi-gtm-4

Copy the token and head over to server side GTM container.

Go to Variables > User Defined Variables > search for “Token” to find the Facebook Conversions API Token variable.

Paste your token into the variable.

facebook-capi-gtm-5

Note: If we’ve already visited this conversion API settings page before then we 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 new token into the server side container variable, it’s time to generate the test event code.
In the modal you will see two options:

  1. Send instructions to developer
  2. Implement yourself

 

Select the implement yourself option.

facebook-capi-gtm-6

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.

facebook-capi-gtm-7

You’ll then see the Test Events tab.

Under the main navigation, you’ll see a secondary nav with Browser and Server. Click on the “Server” tab.

facebook-capi-gtm-9

Copy your test ID shown in the image above.

Then go back to your server side container to paste into another variable.

facebook-capi-gtm-10

Step 5: Update the 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:

facebook-capi-gtm-11

Inside your server side GTM container > variables > user defined variables, paste the value here:

facebook-capi-gtm-12

That’s it!

We’ve completed all of the steps required to start sending test conversions to your Facebook Conversion API via Google Tag Manager.

If you’re interested in speaking with an analytics consultant, please contact e-CENS

Tarun Jain

Tarun Jain

Tarun has rich experience in Digital analytics across multiple industries like Retail, Technology, Automotive and Pharma. He has provided global delivery support and consultation to clients across APAC, EMEA, US and Australia.

Related resources

Struggling With Google Analytics 4 Migration?

We’ve created a guide to help you make sure that you complete the migration process without issues!