# Facebook

advanced expert team enterprise

Keitaro collects information about advertising campaign costs via Facebook and sends conversions to optimize ad campaigns on the source side.

# Settings

Open Maintenance → Integrations, select Facebook integration:

Click Add Account

Description of settings:

  • Name. Name of the new integration.
  • Ad account ID. Account ID.
  • FB Token. Token for connecting to an advertising account via API, see how to connect a token.
  • Pixel ID. Pixel ID is used to send conversions via API, see instructions.
  • Conversions token. To get API conversions, you need to generate a token that is passed as a parameter when requesting the API. See instructions for obtaining a token.
  • API version. Facebook API versioning.
  • Update every. Update integration costs within a specified time range.
  • Choose campaigns. Each integration can be assigned to one or multiple campaigns in a tracker. Choose the campaigns from the list.
  • Use proxy. Make all requests to the FB API with a proxy.

# Getting the account ID

Open Facebook Ads Manager and copy the ID:

# Getting an API token

  1. Log in to Facebook account.

Open the app page and click Create app

  1. Select "Other" and click Next

  1. Choose "Business" and click Next

  1. Add the app name, enter the contact email and click Create app

  1. Open the app settings. Choose Marketing API

  1. Choose "Tools" from Marketing API

  1. Select all checkboxes and press the button to purchase a marker

  1. Copy the API token of the app

# Getting Conversions Token

Get parameters for filling out the Facebook integration fields, according to the instructions

Conversions Token - is taken from the setting up the direct integration of the Personal Account. Click Generate Access Token. See instructions for obtaining a token

WARNING

Copy and save the marker in a safe place. The marker is issued once and cannot be viewed again. Otherwise, reissue the marker.

# Fixing connection errors for integration

The main reasons why users do not receive costs:

  1. Outdated version of the integration API. Make sure that the tracker version (Admin-Keitaro v) you are using is at least 10.1.5. This version of the tracker is compatible with version 18 of the Facebook API.

  2. Incorrect token for connecting to an advertising account via API. The page from which the correct token is taken looks like this:

  1. Lack of Facebook parameters, for example {{adset.id}}, in the Campaign settings in the Settings section, and in the campaign's link that you place in the source. Connect parameters directly from the template in the campaign settings:

If there are no filled parameters or if values other than template ones are used, the costs will not be recorded:

If the traffic primarily goes to a remote site to which the tracker is connected using any integration script (KClient PHP; Tracking script; WordPress plugin), tags from the source template must be added to the site URL as domain.com? adset_id={{adset.id}}&...

  1. In the FB ad settings, a link to the campaign, or the integration site is inserted without additional parameters. When creating an ad, the tags that you receive when using the source must be added to a separate window for parameters.

# Setting up sending conversions and events in Facebook Ads Manager

  1. Create a campaign in the tracker. When creating a campaign, use the Facebook source template, save:

  1. Connect your campaign integration to your Facebook Ads Manager advertising account. See the settings above.
  2. In the integration settings, click Mapping. Select the desired statuses, and events that you want to send to Facebook Ads Manager

  1. Add Pixel ID and Conversions Token, according to the instructions above.
  2. Done! The integration is configured. When target clicks start appearing in the campaign with fbclid parameter (see section Reports — Clicks), send a postback to check:

# How to view conversions in Facebook Ads Manager

  1. The conversion is sent if the fbclid parameter is present:

  1. Open the Facebook Ads Manager page, go to your business account:

  1. Create an advertising campaign:

  1. In the Website URL section, specify the tracker's campaign link with the ID:

  1. Additionally, enter the URL with the tracker's parameters section:

  1. Publish your campaign. Pay attention to the campaign status in your Facebook Ads Manager Personal Account:

  1. After confirming the campaign, as targeted clicks begin to show, check the events in Account Overview section

# Sending additional parameters to Facebook

By default, Keitaro sends the following parameters to Facebook:

               'action_source' => 'website', // This parameter is sent by default and cannot currently be changed.
               'event_name' =>               // Event type specified in the integration setup mapping window.
               'event_time' =>               // Event occurrence time.
               'user_data' => [
                   'fbc' => click identifier,
                   'fbp' => browser identifier,
                   'client_ip_address' => click IP address,
                   'client_user_agent' => click user agent,
                   'country' => country determined based on click IP address,
                   'st' => region determined based on click IP address,
                   'ct' => city determined based on click IP address
                ]
1
2
3
4
5
6
7
8
9
10
11
12

There is an option to send additional parameters in user_data:

  • em - email,
  • ph - phone,
  • fn - first name,
  • ls - last name.

To send these parameters to Facebook in an incoming postback, you need to send the corresponding parameters to the tracker. Example:

http://your_tracker_domain.com/2a76c2a/postback?subid=3sh8so4er3&status=sale&payout=2.61&em=example@gmail.com&fn=John&ln=Snow&ph=+71234567890
1

# FAQ

Error "Not tied to the campaign."

The integration is not selected in the campaign's settings in Keitaro.

Error "Success" status, but costs are not updating.

Make sure there is adset.id parameter both in campaign's parameters in Keitaro and in Facebook link.

Integration shows an error.

Check the Facebook token, make sure it is not expired and valid for the account.

How does currency conversion work?

The tracker takes the currency from the Facebook account and converts it into the tracker's currency.