# AppsFlyer Mobile Events API

[Appsflyer](https://www.appsflyer.com/)'s platform is used by businesses to understand how users find and interact with their apps.\
Using this destination you can leverage [AppsFlyer Server-to-Server Events API](https://dev.appsflyer.com/hc/reference/s2s-events-api3-overview) to send mobile events to AppsFlyer for your Android or iOS applications.

## Key features

The AppsFlyer Mobile Events API destination provides the following key features:

* **Events structure**: our [Events reference](https://community.commandersact.com/platform-x/developers/tracking/events-reference) supports [AppsFlyer's event structure](https://dev.appsflyer.com/hc/reference/s2s-events-api3-post), meaning that your data is properly bridged to the expected fields in an optimized way.
* **Prebuilt mappings**: data mapping for event-based destinations happens automatically, which simplifies user inputs.
* **Custom events and properties**: you can freely push custom events and properties based on your specific needs.
* **Smart mapping**: data mapping can be readjusted using your datalayer defined fields.

## Destination setup

{% hint style="info" %}
Ensure your app is registered in [AppsFlyer](https://hq1.appsflyer.com/auth/login) under <mark style="color:blue;">`My Apps`</mark> .
{% endhint %}

### Configuration

| Settings              | Description                                                                                                                                                                                                                                                                                                                                             |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Token`               | <p><em><strong><code>Required</code></strong></em><br>Your authorization S2S token. You can find its value in the <a href="https://support.appsflyer.com/hc/en-us/articles/360004562377-Managing-AppsFlyer-tokens#reaching-the-tokens-page">AppsFlyer's dashboard</a>.</p>                                                                              |
| `Application Id`      | <p><em><strong><code>Required</code></strong></em><br>Your application identifier (app-id). You can find its value in the <a href="https://hq1.appsflyer.com/unified-ltv/dashboard">AppsFlyer's dashboard</a> under <code>Settings</code> → <code>My Apps</code> → mouse over just below your app name → click <code>Copy app id</code> .</p>           |
| `AppsFlyer Id`        | <p><em><strong><code>Required</code></strong></em><br>A unique identifier, generated by AppsFlyer, when the app launches for the first time. More details are available by following this <a href="https://support.appsflyer.com/hc/en-us/articles/207034486-Server-to-server-events-API-for-mobile-S2S-mobile#fetching-the-appsflyer-id">LINK</a>.</p> |
| `Event Mapping`       | Change the standard mapping between AppsFlyer events and yours or add new mappings.                                                                                                                                                                                                                                                                     |
| `Custom Data Mapping` | Map your custom parameters by setting their field names in `AppsFlyer parameter` and adding the value in `Your value`.                                                                                                                                                                                                                                  |

## Quick reference

| Commanders Act Events                                               | AppsFlyer Events                   |
| ------------------------------------------------------------------- | ---------------------------------- |
| `achievement_unlocked`                                              | `af_achievement_unlocked`          |
| `ad_click`                                                          | `af_ad_click`                      |
| `ad_view`                                                           | `af_ad_view`                       |
| `add_payment_info`                                                  | `af_add_payment_info`              |
| `add_to_cart`                                                       | `af_add_to_cart`                   |
| `add_to_wishlist`                                                   | `af_add_to_wishlist`               |
| `app_opened`                                                        | `af_app_opened`                    |
| `sign_up`                                                           | `af_complete_registration`         |
| `view_item`                                                         | `af_content_view`                  |
| `begin_checkout`                                                    | `af_initiated_checkout`            |
| `invite`                                                            | `af_invite`                        |
| `generate_lead`                                                     | `lead`                             |
| `level_achieved`                                                    | `af_level_achieved`                |
| `view_item_list`                                                    | `af_list_view`                     |
| `login`                                                             | `af_login`                         |
| `notification_open`                                                 | `af_opened_from_push_notification` |
| <p><code>in\_app\_purchase</code><br><code>purchase</code></p>      | `af_purchase`                      |
| <p><code>submit\_rating</code><br><code>rate</code></p>             | `af_rate`                          |
| `re_engage`                                                         | `af_re_engage`                     |
| <p><code>view\_search\_results</code></p><p><code>search</code></p> | `af_search`                        |
| `share`                                                             | `af_share`                         |
| `spend_virtual_currency`                                            | `af_spent_credits`                 |
| `spent_credits`                                                     | `af_spent_credits`                 |
| `start_trial`                                                       | `af_start_trial`                   |
| `subscribe`                                                         | `af_subscribe`                     |
| `travel_booking`                                                    | `af_travel_booking`                |
| `ecommerce_purchase`                                                | `af_travel_booking`                |
| `tutorial_complete`                                                 | `af_tutorial_completion`           |
| <p><code>app\_update</code><br><code>update</code></p>              | `af_update`                        |
| `[Any Event]`                                                       | `[Any Event]` **\[1]**             |

{% hint style="info" %}
**1.** See <mark style="color:blue;">`Event Mapping`</mark> in [Configuration](#configuration).
{% endhint %}

## Field mappings

{% hint style="info" %}
Properties can be remapped using our [Smart Mapping](https://doc.commandersact.com/features/destinations/advanced-mapping#smart-mapping) feature.
{% endhint %}

<table data-header-hidden="false" data-header-sticky><thead><tr><th width="361">Smart Mapping Field</th><th width="423">Commanders Act Default Properties</th><th width="393">AppsFlyer Properties</th></tr></thead><tbody><tr><td>-</td><td><code>AppsFlyer Id</code></td><td><code>appsflyer_id</code> <strong>[*]</strong></td></tr><tr><td>-</td><td><code>(event_name)</code></td><td><code>eventName</code> <strong>[*][1]</strong></td></tr><tr><td><code>Event Timestamp</code></td><td><code>context.event_timestamp</code></td><td><code>eventTime</code></td></tr><tr><td><code>User Id</code></td><td><code>user.id</code></td><td><code>customer_user_id</code></td></tr><tr><td><code>Device IP</code></td><td><code>context.device.ip</code></td><td><code>ip</code></td></tr><tr><td><code>Event Value</code></td><td><code>value</code></td><td><code>af_revenue</code> <strong>[2]</strong></td></tr><tr><td><code>Content Type</code></td><td><code>partners.appsflyer.content_type</code></td><td><code>af_content_type</code> <strong>[2]</strong></td></tr><tr><td><code>Content Identifier</code></td><td><code>partners.appsflyer.content_id</code></td><td><code>af_content_id</code> <strong>[2]</strong></td></tr><tr><td><code>Custom Attribute</code></td><td><code>partners.appsflyer.your_custom_attribute</code></td><td><code>your_custom_attribute</code> <strong>[2]</strong></td></tr><tr><td><code>App Version</code></td><td><code>context.app.version</code></td><td><code>app_version_name</code></td></tr><tr><td><code>App Store</code></td><td><code>partners.appsflyer.app_store</code></td><td><code>app_store</code></td></tr><tr><td><code>Currency</code></td><td><code>currency</code></td><td><code>eventCurrency</code></td></tr><tr><td><code>App Namespace</code></td><td><code>context.app.namespace</code></td><td><code>bundleIdentifier</code></td></tr><tr><td><code>Sharing Filters</code></td><td><code>partners.appsflyer.sharing_filters</code></td><td><code>sharing_filter</code></td></tr><tr><td><code>Is App Clip</code></td><td><code>(partners.appsflyer.is_app_clip)</code></td><td><code>app_type</code> <strong>[3]</strong></td></tr><tr><td>-</td><td><code>Custom Data Mapping</code></td><td><code>custom_data</code></td></tr><tr><td><code>Device OS Name</code></td><td><code>context.device.os.name</code></td><td><code>os</code></td></tr><tr><td><code>Device User Agent</code></td><td><code>context.device.user_agent</code></td><td><code>ua</code></td></tr><tr><td><code>Ad Tracking Enabled</code></td><td><code>(context.device.ad_tracking_enabled)</code></td><td><code>aie</code> <strong>[4]</strong></td></tr><tr><td><code>Device Mobile Identifier</code></td><td><code>context.device.advertising_id</code></td><td><code>advertising_id</code><br><code>idfa</code></td></tr><tr><td><code>Open Advertising Id</code></td><td><code>partners.appsflyer.oaid</code></td><td><code>oaid</code></td></tr><tr><td><code>Amazon Advertising Id</code></td><td><code>partners.appsflyer.aid</code></td><td><code>amazon_aid</code></td></tr><tr><td><code>International Mobile Equipment Identity</code></td><td><code>partners.appsflyer.imei</code></td><td><code>imei</code></td></tr><tr><td><code>App Set Id Scope</code></td><td><code>partners.appsflyer.app_set_id_scope</code></td><td><code>app_set_id.scope</code></td></tr><tr><td><code>App Set Id</code></td><td><code>partners.appsflyer.app_set_id</code></td><td><code>app_set_id.id</code></td></tr><tr><td><code>Device IDFV</code></td><td><code>context.device.idfv</code></td><td><code>idfv</code></td></tr><tr><td><code>iOS ATTrackingManager Status</code></td><td><code>partners.appsflyer.att</code></td><td><code>att</code></td></tr><tr><td><code>TCF String</code></td><td><code>partners.appsflyer.tcf_string</code></td><td><code>tcf.tcstring</code> <strong>[5]</strong></td></tr><tr><td><code>TCF Policy Version</code></td><td><code>partners.appsflyer.tcf_policy_version</code></td><td><code>tcf.policy_version</code> <strong>[5]</strong></td></tr><tr><td><code>CMP SDK Identifier</code></td><td><code>partners.appsflyer.cmp_sdk_id</code></td><td><code>tcf.cmp_sdk_id</code> <strong>[5]</strong></td></tr><tr><td><code>CMP SDK Version</code></td><td><code>partners.appsflyer.cmp_sdk_version</code></td><td><code>tcf.cmp_sdk_version</code> <strong>[5]</strong></td></tr><tr><td><code>GDPR Applies</code></td><td><code>partners.appsflyer.gdpr_applies</code></td><td><code>manual.gdpr_applies</code> <strong>[5][6]</strong><br><code>tcf.gdpr_applies</code> <strong>[5][6]</strong></td></tr><tr><td><code>Ad User Data Enabled</code></td><td><code>partners.appsflyer.ad_user_data_enabled</code></td><td><code>manual.ad_user_data_enabled</code> <strong>[5]</strong></td></tr><tr><td><code>Ad Personalization Enabled</code></td><td><code>partners.appsflyer.ad_personalization_enabled</code></td><td><code>manual.ad_personalization_enabled</code> <strong>[5]</strong></td></tr></tbody></table>

{% hint style="info" %}
**\*** Mandatory property.\
**1.** See [Quick reference](#quick-reference) for more details.\
**2.** Set in the property <mark style="color:blue;">`eventValue`</mark> .\
**3.** Set with <mark style="color:blue;">`app_clip`</mark> if <mark style="color:blue;">`partners.appsflyer.is_app_clip`</mark> is <mark style="color:blue;">`true`</mark> .\
**4.** Set with the opposite value in <mark style="color:blue;">`context.device.ad_tracking_enabled`</mark> .\
**5.** Set in the property <mark style="color:blue;">`consent_data`</mark> .\
**6.** These fields are mutually exclusive .
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.commandersact.com/features/destinations/destinations-catalog/appsflyer/appsflyer-mobile-events-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
