# Facebook Ads

To help you understand the effectiveness of your ad campaigns, Qonversion sends data directly to your Facebook Ads account.

{% hint style="info" %}
Qonversion tracks revenue even if users don't open the app. This allows you to measure the performance of each subscription plan with 100% accuracy.
{% endhint %}

‌Use this integration to:

* See how your ads impact trial starts, trial conversions, purchases, subscriptions, and renewals. Please see the list of all the events [here](https://qonversion.gitbook.io/docs/overview/tracked-events).
* Measure the return on your advertising spend based on accurate revenue data.
* Create a custom Facebook audience (Lookalike Audience) based on your paying users to increase your advertising ROI (ROAS). Show ads to people similar to those who convert into paying users after a trial period.

## Facebook SDK

&#x20;   1\. First, you need to have **Facebook's SDK integration** in place. Please follow [Facebook’s  documentation](https://developers.facebook.com/docs/analytics/quickstart-list/ios/) for that.

&#x20;   2\. **Set your Qonversion UID to Facebook's SDK:**&#x20;

{% tabs %}
{% tab title="Swift" %}

```swift
Qonversion.launch(withKey: "projectKey") { (result, error) in 
   AppEvents.userID = result.uid
}
```

{% endtab %}

{% tab title="Objective-C" %}

```swift
[Qonversion launchWithKey:@"" completion:^(QNLaunchResult * _Nonnull result, NSError * _Nullable error) {
   [FBSDKAppEvents setUserID:uid];
}];
```

{% endtab %}

{% tab title="Java" %}

```java
Qonversion.initialize(this, "ApplicationKey", "yourSideUserID");

AppEventsLogger.setUserID("yourSideUserID")

```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}

#### Do not track any purchase events on the client side.

Qonversion tracks and sends all revenue events so if you track revenue events with Facebook SDK, you may double count the revenue in your Facebook Ads account.
{% endhint %}

&#x20;    3\. **Get your Facebook Access App Token.** You can use [this URL](https://developers.facebook.com/tools/explorer/) to access your token. (Choose your Application in the top-right corner. Select the Get App Token and copy:

![](https://3525059718-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ln7WeqpqZov_YGY_qi1%2F-M9Jyhv4uASbZhiEPRXw%2F-M9Jyu_lBmilxMbWnRZe%2Fimage.png?alt=media\&token=200b3cd4-7bbe-4b3d-af64-5a04d280d863)

&#x20;   4\. **Input your Facebook Access Token into your Qonversion** [**account**](https://dash.qonversion.io/app/integration/facebook)**.**&#x20;

{% hint style="warning" %}
Note: It may take up to 24 hours for recently delivered events to appear in Facebook.
{% endhint %}

&#x20;   5\. **Event names**. If you want events to show up in your Facebook Ads Account you need use the [Facebook standard event names](https://docs.qonversion.io/for-marketers/facebook-sdk-standard-events). You can configure the event names in the [integration section](https://dash.qonversion.io/app/integration/facebook).&#x20;

| Facebook Standard Event name    | Value |
| ------------------------------- | ----- |
| StartTrial                      | Yes   |
| Subscribe                       | Yes   |
| fb\_mobile\_purchase            | Yes   |
| fb\_mobile\_add\_to\_cart       | Yes   |
| fb\_mobile\_add\_to\_wishlist   | Yes   |
| fb\_mobile\_initiated\_checkout | Yes   |

{% hint style="success" %}
**100% Done!** Now Qonversion will send subscription events to Facebook Ads Manager.
{% endhint %}

**You're all set.** You can view the detailed subscription related events in your Facebook Ads account (Analytics, Ads Manager, Audience), get insights on your performance, and improve your marketing ROAS with Lookalike Audience. **Please read our guide on using Lookalike Audience in Facebook Ads** [**here**](https://docs.qonversion.io/for-marketers/facebook-ads-manager-with-qonversion)**.**
