Facebook is a major traffic source, but it’s not always convenient to work with. Facebook doesn’t support automatic costs distribution. We came up with an API integration that allows Binom syncing costs automatically.
How it works
access_token will connect a Facebook account to a campaign in Binom. Every 30 minutes Binom goes through the connected accounts and gets costs in terms of the {{ad.id}} token and updates the costs. To make the integration work you need to do the following:
— Connect a Facebook account to a campaign in Binom
— Pass the {{ad.id}} token from Facebook to Binom
If you can not pass the {{ad.id}} token, sync the costs of the whole account, like this:
In this case Binom will get the costs per day of the whole account and distribute it among all the clicks per that day.
To minimize the number of side queries in Facebook, Binom only goes through the accounts with clicks. For example, if a campaign got 0 clicks from 15:00 to 24:00, Binom will not ask the accounts connected to that campaign.
Sometimes it may take a while to have the Facebook costs updated, so Binom updates the statistics of active campaigns for the previous day three times a day.
Getting Access token
1) Go to Meta for Developers: https://developers.facebook.com/ under the account that created the advertising account.
2) Click Create App:
3) In the Create an app section select Other and Click Next:
4) In Type section select Business and click Next. Enter a name and click Create app.
5) Next, go back to the Apps section and click the three dots in the window of the created app.
6) Click Create Test App and click Confirm :
7) Scroll down the page and in Marketing API section click Set up:
8) Check the box next to ads_management and then click the Get token button to copy the Access token:
9) Go to the link https://developers.facebook.com/tools/debug/accesstoken/ and click on Extend Access Token to copy the new token
10) To further protect your account from being banned, you can use the same proxy that will be specified in the tracker during the app registration process and fill in the browser useragent from which the developer account was created. The Access cookie field is for service purposes, it will be filled in automatically. When creating a new account, you need to leave it blank and do not edit it when changing.
Adding Proxy
By default Binom will send queries to Facebook from a server it’s installed on. Facebook sees those queries as logging in. Sometimes Facebook considers it suspicious if logging in is performed from different devices and can change access_token. To make things worse, the device you’re using may affect the quality of the account. To avoid it, use proxy.
Go to Traffic Sources > Accounts > Proxies.
Specify your proxy settings. Keep in mind that most of the mobile proxies have two additional timeouts. The first one is the time a proxy provider needs to change the IP. The second one is the time that proxy provider prevents the IP from changing (i.e. how often you can get Change URL). This leads to the limit of the accounts which can be connected to a certain proxy. If you reach that limit, Binom might not have enough time to go through all the accounts.
Using proxy is not obligatory.
Adding Facebook account
If Facebook has more than one account connected to access_token, specify the one you need in the Facebook ID field:
Keep in mind that as soon as you add access_token a query is passed to Facebook, so make sure to set up Proxy first and only then add access_token. Ignore a warning in the Access token field if you don’t use proxy.
Comments
Other than updating Facebook costs, once every 30 minutes Binom will also check if your Facebook ads belonging to that account received any comments.
Depending on the action chosen, Binom can do one of the following:
- — Leave comments be (default option);
- — Hide comments;
- — Delete comments.
Please note that there are limits on certain actions in Facebook. These limits may depend on your account quality and other inside FB criteria. Binom will create a queue of requests with your chosen action and execute these for as long as Facebook accepts these requests (i.e. requests are within the FB limit).
Setting up a campaign
After adding a Facebook account to Binom you need to connect it to a campaign. Go to the campaign settings, open Integrations and add your account:
You must also specify Traffic Source with the ad.id token for Token 1:
It needs to be done so that Binom could update the costs referring to the ad.id token. Click Load from template and select Facebook to load the settings.
Those were the final steps. In the end you can make sure that Facebook has the {{ad.id}} token specified: