# Facebook CAPI through GTM

Commanders Act provides a GTM template to connect your existing GTM implementation to our serverside endpoint, enabling "Facebook CAPI" in a secured environment.

### Setup

1. Add our bridge tag
2. Update your Facebook tags

### 1. Add our bridge tag

First, access [GTM ](https://tagmanager.google.com/)and then add our template "**Commanders Act | Serverside events bridge**"\
You can follow our dedicated guide:

{% content-ref url="/pages/6a4S0tgj4uWNAzl3Vhu7" %}
[Google Tag Manager (GTM)](/features/sources/sources-catalog/web/gtm.md)
{% endcontent-ref %}

### 2. Update your Facebook tags

If you're planning to keep running your existing Facebook pixels while using "Facebook CAPI" through GTM, it's really important that you update them following these guidelines. This will allow to deduplicate and keep consistent measurements of your events.

The process is straightforward as for every event you're sending via pixel tags you just need to add the event identifier - On GTM, open your "Facebook Pixel" tag and expand (14) "**More Settings**" to locate the "**Event ID**" and click (15) its icon on the right.

![](/files/kALSgAWAyg5hlIcJ4Fyh)

A new window will slide-in. Click on `(16)` the **plus on the top right.**

<figure><img src="/files/Z774dWCw4sRWO8Xd04iX" alt=""><figcaption></figcaption></figure>

Click on `(17)` the "**Variable Configuration**".

![](/files/GpFTYtzLNrzrBWwWUg9Z)

Click `(18)` the "**JavaScript Variable**".

![](/files/T2m6sGIDXYtp4jD3JXXC)

Rename your `(19)` variable as ***window\.tC.uniqueEventId*** and set the same name in `(20)` the "**Global Variable Name**" then click `(21)` the "**Save**" button.

<figure><img src="/files/DEhYmJNTFl1wQo8OkGw6" alt=""><figcaption></figcaption></figure>

Back on the tag configuration, expand `(22)` "**Advanced Settings**" and `(23)` "**Tag Sequencing**" to check `(24)` the option "**Fire a tag before Facebook Pixel fires**". In "Set-up Tag", select `(25)` "*Commanders Act | Serverside events bridge*" and save your tag.

![](/files/OWyqLmN6GtjDEd3lNLKs)

{% hint style="success" %}
Repeat this configuration for each active "Facebook Pixel" in GTM.
{% endhint %}

{% hint style="info" %}
See Facebook documentation for more details: [Deduplicate Pixel and Server Event](https://developers.facebook.com/docs/marketing-api/conversions-api/deduplicate-pixel-and-server-events)
{% endhint %}

{% hint style="info" %}
Contact your reference consultant or our [Support team](mailto:support@commandersact.com) in case you need assistance.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.commandersact.com/features/destinations/destinations-catalog/facebook/facebook-conversions-api/facebook-capi-through-gtm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
