> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appcharge.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AppsFlyer Integration

Integrate with [AppsFlyer](https://www.appsflyer.com/), a Mobile Measurement Partner (MMP), to extend your game analytics to your web store. This code-free integration lets you track player revenue, lifetime value (LTV), and engagement across channels and devices, while connecting player activity between your game and Appcharge. With minimal setup, you get a complete view of the player journey, as events are shared in both directions. This gives you deeper insights into player behavior and helps optimize your marketing strategy.

When a player logs in to your game, AppsFlyer sends Appcharge the player's [CUID](https://support.appsflyer.com/hc/en-us/articles/207032016-Customer-User-ID-field-CUID) and AppsFlyer ID for identification. When that player makes a purchase or receives a refund through Appcharge, Appcharge sends the event back to AppsFlyer for campaign attribution.

## AppsFlyer integration setup

Follow these steps to configure the AppsFlyer integration on both Appcharge and AppsFlyer's side.

### Configure in AppsFlyer

To configure the integration in AppsFlyer:

1. Log in to your [AppsFlyer HQ account](https://hq1.appsflyer.com/auth/login?next=L2F1dGgvbG9naW4mZW5jb2RlZD0x), or create one if needed.
2. Follow the instructions to [go to the token page](https://support.appsflyer.com/hc/en-us/articles/360004562377-Managing-AppsFlyer-tokens#reaching-the-tokens-page), and then follow the steps to [create a new S2S (server-to-server) token or retrieve an existing one](https://support.appsflyer.com/hc/en-us/articles/360004562377-Managing-AppsFlyer-tokens#manage-your-tokens).
   <Note>You must be an AppsFlyer account admin to view or manage tokens.</Note>
3. Copy and save the S2S token for later.
4. Follow [AppsFlyer's documentation](https://support.appsflyer.com/hc/en-us/articles/36292113943825-Appcharge-integration-with-AppsFlyer#setting-up-appcharge) on how to set up the integration with Appcharge. As part of this setup:

   * Set up integrations for all your AppsFlyer apps that you want to integrate with Appcharge, and save all the app IDs for later.
   * In the [in-app event postbacks](https://support.appsflyer.com/hc/en-us/articles/36292113943825-Appcharge-integration-with-AppsFlyer#inapp-event-postbacks) section, add all your game login events and make sure each includes the player's CUID (player ID) and AppsFlyer ID. When a player logs in, AppsFlyer sends this data to Appcharge to identify the player. Appcharge uses the most recent AppsFlyer ID to identify each player, so attribution is always tied to the last device they logged in on.

   <Note>Attribution is only recorded when a player logs in. If a player is already logged in, Appcharge won't receive their AppsFlyer ID until they log in again.</Note>

### Configure in Appcharge

To configure the integration in Appcharge:

1. Go to the Publisher Dashboard. In the sidebar menu, go to **Management > Settings > Developer Settings**.

   <Note>If you have a Game Portal, follow the same steps in your Game Portal project.</Note>

2. Scroll to **AppsFlyer S2S Integration**, and click **Open Settings**.

3. Complete the following sections:

   * **AppsFlyer S2S Integration**: Toggle on to enable the integration.

   * **AppsFlyer S2S Token**: Enter the S2S token saved from AppsFlyer. This token allows Appcharge to send attributed events to AppsFlyer on your behalf.

   * **Application ID**: Enter the ID of your AppsFlyer app. Click **+ Application ID** to add additional app IDs as needed.

   * **Event Name Configuration**: Set the event names that Appcharge will use when sending events to AppsFlyer.

     * **Purchase Event**: The event name to send to AppsFlyer when a player completes a purchase on the Appcharge platform. Defaults to `appcharge-billing-payment`.
     * **Refund Event**: The event name to send to AppsFlyer when a player receives a refund through Appcharge. Defaults to `appcharge-billing-refund`.

4. In the top right corner, click **Save** to save your changes.
