Facebook Conversions API
This guide describes how to add and configure Facebook Conversions API integration.
The Conversions API allows advertisers to send web events from their servers directly to Facebook. Server events are linked to a pixel and are processed like browser pixel events. This means that server events are used in measurement, reporting, and optimization in the same way as browser pixel events. Your in-app purchase events including subscription renewals will be sent to Facebook as web events.

Using Conversions API for Web-to-App campaign optimization

Conversions API is useful when running Web-to-App (or Web2App) campaigns in Facebook with event optimization. Learn more.
Web-to-App campaign is a web campaign targeted to your app’s landing page which has a link to the App Store.

Benefits of using web-to-app advertising:

  • Real time attribution for matched users. Apphud handles this for you.
  • Lower CPA. Web acquisition costs in most cases are less then app acquisition costs.
  • Ability to test web payments before app install. Some app owners may want to test web payments instead of In-App purchases.
  • Optimize for purchase events the same way as app events.
  • Web onboardings. You can test different onboardings and other user journeys on-the-fly, without the need of the app resubmission.

Requirements

  1. 1.
    Verified domain for your landing page.
  2. 2.
    Create Facebook Pixel.
  3. 3.
    Configure and prioritize events in Events Manager of your pixel. Only prioritized events can be used for advertising. The most valuable event, like purchase event, should always have the highest priority.
Purchase event should have the highest priority

How to add integration?

Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Step 7
  • In Business settings create Facebook Pixel if you don't have it yet.
  • In Business settings create System User with Employee role and assign your Pixel asset to it:
  1. 1.
    Make sure View Pixels permission is on.
  2. 2.
    Click on Generate New Token, select your app and copy the value.
  • Go to Apphud integrations page and select Facebook Conversions API.
  • Insert Pixel ID and Access Token that you got in previous steps.
  • Edit your events configuration by disabling unnecessary ones or changing event names.
  • Click on Enable integration and Save.
Remove the following lines from your landing page's Facebook Pixel code because we will add them later with Apphud Pixel JS Code:
1
fbq('init', '{your-pixel-id-goes-here}');
2
fbq('track', 'PageView');
Copied!
After saving an integration a script text area will appear. Copy the entire JS script and add it to your landing page after Facebook Pixel code.
Here is full example of scripts in your landing page. You shoud not add this script directly to your page, because it contains different identifiers!
1
<!-- Facebook Pixel Code -->
2
<script>
3
!(function (f, b, e, v, n, t, s) {
4
if (f.fbq) return;
5
n = f.fbq = function () {
6
n.callMethod
7
? n.callMethod.apply(n, arguments)
8
: n.queue.push(arguments);
9
};
10
if (!f._fbq) f._fbq = n;
11
n.push = n;
12
n.loaded = !0;
13
n.version = "2.0";
14
n.queue = [];
15
t = b.createElement(e);
16
t.async = !0;
17
t.src = v;
18
s = b.getElementsByTagName(e)[0];
19
s.parentNode.insertBefore(t, s);
20
})(
21
window,
22
document,
23
"script",
24
"https://connect.facebook.net/en_US/fbevents.js"
25
);
26
</script>
27
<noscript>
28
<img height="1" width="1" style="display: none" src="https://www.facebook.com/tr?id={your-pixel-id-goes-here}&ev=PageView&noscript=1" />
29
</noscript>
30
<!-- End Facebook Pixel Code -->
31
32
<script type="text/javascript">
33
(function (a, p, _p, h, u, d) {
34
u = a.aph = function () {
35
u.callMethod
36
? u.callMethod.apply(u, arguments)
37
: u.queue.push(arguments);
38
};
39
u.loaded = 1;
40
u.version = "1.0";
41
u.queue = [];
42
(d = p.createElement(_p)),
43
(y = p.getElementsByTagName(_p)[0]),
44
(d.async = 1),
45
(d.src = h),
46
y.parentNode.insertBefore(d, y);
47
})(window, document, "script", "https://cdn.apphud.com/pixel.js");
48
aph("init", "f127c4c1-f15e-4b19-9dad-12356e8f6ef9");
49
aph("fb", "{your-pixel-id-goes-here}");
50
</script>
Copied!

Receive Attribution Data

In order to get attribution data from Facebook web campaigns, you will need add URL parameters to understand where visitors are coming from.
Paste these parameters to URL parameters field in Tracking section of your ad set up page.
campaign_name={{campaign.name}}&adset_name={{adset.name}}&ad_name={{ad.name}}&network=facebook
More information about URL parameters can be found here and here.

Analyze Facebook campaigns in Apphud

If attribution data is received correctly, you can view any charts including cohorts segmented by Facebook attribution data:

Troubleshooting

Please double check the following list in case you experience issues with integration. Make sure the following is correct:
  • Your landing page should contain correct script code. See step 5 and 6 of integration guide. Step 7 shows example of how it should look like.
  • Events should be correctly prioritized in Web Events Configuration page in Events Manager. The most valuable event, like purchase event, should have the highest priority.
  • Only prioritized events can be used for advertising.
  • Prioritized events should be correctly mapped with Apphud events in integration settings page. For example, Subscription Started event should be mapped either with purchase or subscribe event. It's up to developer to choose desired mapping.
  • Keep in mind that whenever a customer takes multiple actions during a conversion window, only the highest priority event is recorded.
  • Double check that System User has your pixel as assigned asset.
  • Still having troubles? Contact us.

Useful Tips

  • You may experience low install or purchase rate when running Web-to-App campaign with Purchase event optimization. Consider targeting for less priority events at the beginning, like User Created , Paywall Shown or Paywall Checkout Initiated. You can view and edit event mapping in Facebook Conversions API integration page.
By default, "User Created" event is mapped to Lead event. You can change this at any time.

Last modified 10d ago