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

# Track Ad Attribution and App Campaigns with AppsFlyer

> Connect AppsFlyer to Rey to attribute installs to the right campaigns, measure marketing ROI, and track in-app events — automatically, with no extra code.

AppsFlyer is the leading mobile attribution platform. It tells you exactly which ads, campaigns, and channels drove each install and in-app action — so you know where to invest your marketing budget and where to cut spending. Connecting AppsFlyer to Rey means Rey automatically sends attribution-ready data to AppsFlyer the moment your app goes live, with no additional code required.

## What AppsFlyer Does

AppsFlyer sits at the intersection of your app and your ad networks. When a user sees your ad, taps it, and installs your app, AppsFlyer matches that install to the specific campaign, ad set, and creative that drove it. This lets you calculate the true return on ad spend (ROAS) for every channel — from Meta and Google Ads to TikTok, Apple Search Ads, and beyond.

## Prerequisites

Before connecting AppsFlyer to Rey, make sure you have:

* An [AppsFlyer account](https://www.appsflyer.com) with an app registered.
* Your **AppsFlyer Dev Key** — find it in the AppsFlyer dashboard under **Settings → App Settings → Dev Key Management**.
* Your app submitted to (or registered with) the **App Store** or **Google Play** — AppsFlyer attribution requires a real app store listing.

## Connect AppsFlyer to Rey

<Steps>
  <Step title="Register your app in AppsFlyer">
    Log in to your AppsFlyer dashboard and create a new app. Enter your app's bundle ID (iOS) or package name (Android). AppsFlyer generates a unique **Dev Key** for your account — this key is shared across all your apps in the same account.
  </Step>

  <Step title="Copy your Dev Key">
    In the AppsFlyer dashboard, go to **Settings → App Settings → Dev Key Management** and copy your Dev Key. Keep this key private — it authenticates all SDK communication between your app and AppsFlyer.
  </Step>

  <Step title="Enter your Dev Key in Rey">
    In the Rey editor, open the **Integrations** panel, select **AppsFlyer**, and paste your Dev Key into the Dev Key field.
  </Step>

  <Step title="Save and verify the connection">
    Click **Save**. Rey activates the AppsFlyer integration. A green status indicator appears on the AppsFlyer card in the Integrations panel. Rey will begin sending events as soon as your app is opened by a user.
  </Step>
</Steps>

## What Rey Tracks Automatically

Once connected, Rey sends the following events to AppsFlyer without any additional configuration:

| Event         | Description                                      |
| ------------- | ------------------------------------------------ |
| `app_install` | Fired on first launch after install              |
| `first_open`  | Fired the first time a user opens the app        |
| `screen_view` | Fired each time a user navigates to a new screen |

These three events cover the most critical attribution signals AppsFlyer needs to match installs to campaigns.

<Note>
  AppsFlyer attribution requires your app to be published on the App Store or Google Play. Attribution does not work for apps tested only in the Rey preview environment — install events must originate from a real app store installation.
</Note>

## Send Custom Events

Beyond automatic events, you can fire custom events from any **action** in Rey's Logic tab. Use custom events to track high-value moments specific to your app, such as completing onboarding, making a purchase, or reaching a key feature.

To add a custom event:

1. Select the component you want to track (typically a button) in the Rey editor.
2. Open the **Logic** tab in the property toolbar, choose a trigger, and add a **Track Event** action.
3. Enter your event name (for example, `purchase_completed` or `sign_up`) and any properties you want to include.

<Tip>
  Use snake\_case for event names and keep them consistent across iOS and Android. AppsFlyer treats `Purchase_Completed` and `purchase_completed` as different events, which can split your reporting.
</Tip>

## View Attribution Data

All attribution data — installs by campaign, cost per install, ROAS, in-app event counts — appears in your **AppsFlyer dashboard** in real time. You don't need to configure anything in Rey to view reports; the data flows automatically once the integration is active.

<AccordionGroup>
  <Accordion title="How do I set up deep links for campaigns?">
    Deep links let campaign URLs open your app at a specific screen. Configure OneLink deep links in the AppsFlyer dashboard under **Engagement & Deep Linking → OneLink**. Once your OneLink is set up, use it as your campaign destination URL. Rey handles the incoming deep link and routes users to the correct screen.
  </Accordion>

  <Accordion title="Can I use AppsFlyer with both iOS and Android?">
    Yes. Add your iOS and Android apps as separate apps in AppsFlyer (each gets its own app ID), but they share the same Dev Key. In Rey, enter the same Dev Key regardless of platform — Rey applies it to the correct platform automatically at build time.
  </Accordion>

  <Accordion title="Does AppsFlyer work with Apple's SKAdNetwork?">
    Yes. AppsFlyer is fully compliant with Apple's SKAdNetwork (SKAN) for privacy-preserving attribution on iOS 14.5 and later. Configure your SKAN conversion values in the AppsFlyer dashboard; Rey does not require any changes on your end.
  </Accordion>
</AccordionGroup>
