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:


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:


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 the pixel and when you get to this Generate Access Token screen then go ahead and generate a token.


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.


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.


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.


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.


Copy your test ID shown in the image above.

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


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:


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


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

If This Blog Helped You Gain More Experience, Our Newsletter Will Take You to The Next Level!

If you liked this blog and found it helpful, we send a weekly email with more in-depth content!