arrow-left

All pages
gitbookPowered by GitBook
1 of 3

Loading...

Loading...

Loading...

Facebook conversion API

Through serverside v2

triangle-exclamation

This documentation is out of date ! Please refer to our latest documentation instead https://doc.commandersact.com/features/destinations/destinations-catalog/facebook/facebook-conversions-apiarrow-up-right

This connector allows you to push every kind of events directly to Facebook through API. Online conversions, offline conversions... send it to Facebook and it will help you to increase the reach and accuracy of your campaigns.

Currently this destination is open only through our consultings services, please contact our support team or sales.

This connector is compatible with different sources, here is the documentation for each:

  • (web tag, offline conversions, ...)

TagCommander web containers
DataCommander sourcesarrow-up-right
Google Tag Manager container

Facebook CAPI through web container

triangle-exclamation

This documentation is out of date ! Please refer to our latest documentation instead https://doc.commandersact.com/features/destinations/destinations-catalog/facebook/facebook-conversions-apiarrow-up-right

This connector allows you to push every kind of events directly to Facebook through API. Online conversions, add to cart... send it to Facebook and it will help you to increase the reach and accuracy of your campaigns.

You can, for example, not send campaigns related to a specific product to users who already bought it, or you can also send campaigns to users who bought a specific product in cross-sell logic.

hashtag
How to send events to Facebook?

Facebook developed an API called 'Facebook Conversions API'

You need a Facebook Business Manager account

Then on the menu, click on 'Events Manager':

Here, you have to create a new Web Pixel:

Select Conversions API and give a name to your connection:

Now your pixel is created and you will have access to the IDs needed on our connector (send it to our consultants).

hashtag
Where can I find the Pixel ID?

Our consultants need to fill the pixel ID on our connector, it is the ID of the pixel you just created on steps above.

You can find this ID when you click on the pixel's name and on the right of the graph activities. You can find it also on the settings tab.

Please send this Pixel ID to our consultants (+ access token).

Then you need the Access Token

hashtag
Where can I find the access token?

Click on the settings tab.

Scroll until the section 'Conversions API'

Click on the button 'Create Access Token':

circle-exclamation

If you are not able to click on the button 'Create access token', that mean you don't have enough rights to do it. You should be administrator on your Facebook Business account to create it.

Please send this access token to our consultants (+ pixel ID).

hashtag
How to manage consents?

  • Only events with a consent will be sent to Facebook

  • Only conversions with personal information (email and/or phone number...) will be sent to Facebook

hashtag
For customers with our product TRUST Commander:

TRUST Commander is our Consent Management Platform. (More information: )

On the connector, the consent is managed with the field 'User Consent Category'. You should enter a category ID, the one corresponding to Facebook (advertising) on Trust consent categories.

hashtag
For customers without our product TRUST Commander:

We should distinguish 3 cases:

  • Your online events are collected through our Commanders Act event's tag: You have to provide, in the event tags, the list of category ids consented by the user, through the consent_categories property.

  • You are pushing your events to us through API or CSV file: a field consent_categories must be added on the JSON or CSV to precise the consent category IDs of the user. Then inside the connector setting, use the field 'User Consent Category' to enter a category ID, the one corresponding to Facebook (advertising)

hashtag
How the deduplication between the pixel and server is managed?

Using both the pixel and server is recommended per Facebook as it could avoid losing data.

To make it works, you should have the same configuration for both the pixel and server, using same Facebook parameters.

circle-exclamation

event_id should be the same

On the pixel, event_id is automatically generated by our Commanders Act Tag and we retrieve the same value for the server on_integrations.facebook.event_id_. As a result, these 2 values should be the same. Event_name should be the same also.

Fbp parameter is automatically retrieved to keep the same value between pixel and server.

Deduplication works when the same event is sent first from the browser and then from the server, otherwise it creates a duplicate. Events are pushed in real-time.

hashtag
Examples

On pixel:

eventID: tc.uniqueEventId is automatically generated.

On server:

integrations.facebook.event_id automatically retrieves the eventID value coming from the pixel (eventID: tc.uniqueEventId) for standard events.

hashtag
Default Mappings to Facebook Standard Events

The following mappings are fully automated and do not require any additional configuration. Any of the Commanders Act Standard Events in the table below will be sent as the corresponding Facebook Standard Event. The Facebook pixel has more information on these.

COMMANDERS ACT EVENTS
FACEBOOK STANDARD EVENT

hashtag
Facebook Custom Events

To send any of your Commanders Act events (that are not listed in the table above) to Facebook custom events, you don't have anything to do. By default, your unmapped events are automatically sent as a Facebook custom events with the name of your Commanders Act events. If you want to change the name of the custom event that will receive Facebook, you can overwrite the event_name property using integrations.facebook.event_name:'yourCustomEventName'

hashtag
Default Mappings to Facebook Parameters

COMMANDERS ACT STANDARD PROPERTIES
FACEBOOK STANDARD PARAMETERS

Official documentation

Every property can be overridden using integrations.facebook.user_data.<property> (for standard data) or integrations.facebook.custom_data.<property> (for custom data).

hashtag
Minimal required information

Events can only be used if there is enough information to match a user. Facebook expects at least one user_data property, but strongly advises sending as many properties as possible.

Here are our conditions to send the events :

  • at least 1 of those fields: em, ph, external_id, fbp, fbc

  • at least 3 of the other fields

Note : external_id, fbp, fbc will allow matching event with other events. But to match a user, one of those events shall contain additional information (em and ph are best suited for matching)

hashtag
Additional custom Facebook parameters

Custom Facebook parameters could be added.

Facebook allows you to send any data you want in custom data parameters. By default, we fill generic fields when possible (like value, currency, contents...). You can specify in the tag your own parameters in integrations.facebook.custom_data.

You already manage consents on your side and you only send us, from your server,

events that obtained the consent for the category advertising. In this case, do not fill the field ‘User Consent Category’ in the connector.

search

Search

add_payment_info

AddPaymentInfo

add_to_wishlist

AddToWishlist

generate_lead

Lead

page_view

PageView

complete_registration

CompleteRegistration

contact

Contact

customize_product

CustomizeProduct

donate

Donate

find_location

FindLocation

schedule

Schedule

search

Search

start_trial

StartTrial

submit_application

SubmitApplication

subscribe

Subscribe

user.lastname

user_data.ln (last name, hashed)

user.firstname

user_data.fn (first name, hashed)

user.city

user_data.ct (city, hashed)

user.state

user_data.st (state, hashed)

user.zipcode

user_data.zp (zip code, hashed)

user.country

user_data.country (hashed)

browser.ip Automatically set if generated from Commanders Act OneTag

user_data.client_ip_address

browser.user_agent Automatically set if generated from Commanders Act OneTag

user_data.client_user_agent

integrations.facebook.fbc

Automatically set if generated from Commanders Act OneTag

user_data.fbc (Click ID)

integrations.facebook.fbp

Automatically set if generated from Commanders Act OneTag

user_data.fbp (Browser ID)

amount

custom_data.value

currency

custom_data.currency

items

custom_data.contents

name OR first items[i].product.name found

custom_data.content_name

category OR first items[i].product.category_N found (N ∈ [1, 5])

custom_data.content_category

default value : 'product'

custom_data.content_type

status

custom_data.status

begin_checkout

InitiateCheckout

purchase

Purchase

add_to_cart

AddToCart

view_item

ViewContent

view_item_list

ViewContent

user.id (hashed)

user_data.external_id

user.email

user_data.em (email, hashed)

user.phone

user_data.ph (phone, hashed)

user.gender

user_data.ge (gender, hashed)

user.birthdate

https://developers.facebook.com/docs/marketing-api/conversions-apiarrow-up-right
https://business.facebook.com/arrow-up-right
https://www.commandersact.com/en/solutions/trustcommander/arrow-up-right
standard events documentationarrow-up-right
Customer Information Parametersarrow-up-right

user_data.db (birthdate, hashed)

fbq('track', 'AddToCart', {
  value: #CARTVALUE#,
  currency: #CURRENCY#,
  contents: fb_addtocart_products,
  content_type: 'product'
}, { eventID: tC.uniqueEventId });
integrations.facebook.event_id
cact('trigger', 'purchase', {
    "currency": "EUR",
    "amount": 101,
    "integrations": {
        "facebook": {
            "custom_data": {
                "content_name": "booking",
                "your_field": "your_value"
            }
        }
    }
});
Standard Parameters - Conversions API - Documentation - Meta for DevelopersMeta for Developerschevron-right
Logo

Facebook CAPI through GTM

Bridge your events in a seamless way.

triangle-exclamation

This documentation is out of date ! Please refer to our latest documentation instead https://doc.commandersact.com/features/destinations/destinations-catalog/facebook/facebook-conversions-api/facebook-capi-through-gtmarrow-up-right

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

hashtag
Setup

Summarizing all recommended steps:

  1. Add our template

  2. Configure your tag

  3. Update your Facebook tags

hashtag
Add our template

First, access and then add our template "Commanders Act | Serverside events bridge" from the Google "" in your workspace, then select (1) "Tags".

Click on (2) the "New" button.

Click on (3) the "Tag Configuration" area.

Click (4) the magnifying glass in the upper right corner.

Search for (5) the "Commanders Act | Serverside events bridge" custom template and click on it to start the configuration.

hashtag
Configure your tag

Start by filling (6) a name for your tag in the upper left corner.

circle-check

Hint: you may want to name your tag adding the event name you're going to implement in the end. (E.g. "Commanders Act | Serverside events bridge - Purchase")

Input your (7) "Commanders Act Site ID" and select (8) the "Commanders Act Event" from the drop-down menu, which is the event you want to forward.

Depending on which event you select more (or less) fields will be presented. In case you don't input a mandatory field the template will highlight the missing entry so you can provide a proper mapping.

The "Event Fields" section contains fields that define the event itself and are mostly mandatory or highly recommended.

Events including the "Product Fields" section require . The first field will always be the (9) base array where the information is stored and all subsequent fields are the related properties - E.g. you can map the information about (10) the "Product Id" by filling the property name.

In the "User Fields" section you can set (11) the "User Id" and (12) "User Email" - Either one of them is required if you select the "Purchase" event. The (13) "User Consent Categories" is a mandatory field holding an array with the user's consent category identifiers.

It's important to define and map all category identifiers with their respective names. For example, you may have the following array: [1,2,4] and you defined the following relationship:

  • 1 âžœ Advertising category

  • 2 âžœ Analytics category

  • 4 âžœ Functionality category

You also share with Commanders Act that the "Advertising category" must be enabled to activate the "Facebook CAPI." In this example, since the category identifier [1] is included in the array we can activate the bridge and forward the event to Facebook.

circle-info

Ensure your category relationships are shared with Commanders Act.

circle-exclamation

Only with the agreed consent settings, we're allowed to bridge both the "Purchase" and "Refund" events to the "Facebook CAPI".

Complete your configuration by selecting the proper activation in the "Triggering" area / "Firing Triggers".

hashtag
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.

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

Click on (17) the "Variable Configuration".

Click (18) the "JavaScript Variable".

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.

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.

circle-check

Repeat this configuration for each active "Facebook Pixel" in GTM.

circle-info

See Facebook documentation for more details:

circle-info

Contact your reference consultant or our in case you need assistance.

GTM arrow-up-right
Community Template Galleryarrow-up-right
an array structure for your product informationarrow-up-right
Deduplicate Pixel and Server Eventarrow-up-right
Support teamenvelope
Click on "Tags".
Click on "New".
Click on the "Tag Configuration".
Click on the magnifying glass.
Select our template "Commanders Act | Serverside events bridge".
Name your tag.
Input your "Site ID" and select your "Event".
The section "Product Fields".
The section "User Fields".
The "More Settings" including the field "Event ID".
Click on the plus to add a new variable.
Click on the "Variable Configuration".
Select "JavaScript Variable".
Name your variable and the "Global Variable Name" as window.tC.uniqueEventId.
Configure the "Tag Sequencing" to fire your Facebook tag(s) after our template tag.