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

# How to connect

> How to connect the AppsFlyer Cohort data source to Adriel: provision S3 access to Data Locker exports, select an app, and pull day-N retention and revenue curves.

AppsFlyer Cohort is a beta data source that brings day-N cohort retention and revenue curves into Adriel — the share of users from a given cohort still active or paying on day 1, day 7, day 30, and onward through day 360. It reads `cohort_unified` exports written by AppsFlyer Data Locker into an AWS S3 bucket, parses the gzip-compressed CSVs, and serves the resulting retention and revenue metrics from a cache. It is separate from the standard AppsFlyer data source, which continues to supply non-cohort install and event totals.

<Note>
  AppsFlyer Cohort is in beta. Setup requires coordination with AppsFlyer to enable Data Locker exports and with an AWS or DevOps team to provision an IAM user, so plan for a few business days end to end.
</Note>

## Before you connect

The following are required:

* An AppsFlyer account on an **Advanced** or **Enterprise** plan, which is needed to access Data Locker.
* **Cohort Analytics via Data Locker** configured in the AppsFlyer platform (see the Data Locker setup steps below).
* An AWS S3 bucket receiving the AppsFlyer exports, organized in ISO date-named subfolders under a known root path.
* An IAM user with read-only access to the bucket, providing four values: **AWS Access Key**, **AWS Secret**, **AWS Region**, and **S3 Bucket** name. For the IAM setup, see [How to connect Amazon S3](/data-sources/a-f/amazon-s3/how-to-connect).
* The **Directory Path** that contains the date-named subfolders.

<Info>
  There are two separate AppsFlyer data sources. The **AppsFlyer** data source uses the Master API, a REST API for on-demand campaign performance and user activity. The **AppsFlyer Cohort** data source uses Data Locker, AppsFlyer's raw-data delivery feature that writes structured files to cloud storage (AWS S3) on a schedule.
</Info>

### Enable Data Locker on AppsFlyer

<Steps>
  <Step title="Open Data Locker for the app">
    Sign in to AppsFlyer at `dashboard.appsflyer.com` and select the app to enable. In the left-side menu, go to **Export** then **Data Locker**.
  </Step>

  <Step title="Choose the storage destination">
    Choose **Amazon S3** as the cloud storage destination.
  </Step>

  <Step title="Configure the storage details">
    Create the AWS bucket first, then enter its name. The `af-` prefix is mandatory and must be typed manually. Click **Test connection** and confirm no invalid-bucket-path error appears. Choose whether to make the connection compatible with Adobe Experience Platform, then click **Save**.
  </Step>

  <Step title="Set the report output settings">
    Set **File format** to CSV, **File compression** to GZIP, and the recommended max row count to 100K. Leave the expected path at its default. The date-folder format must stay `dt=yyyy-mm-dd` — a different format prevents the connection from working.
  </Step>

  <Step title="Select the reports and save">
    Select reports for all account apps. The recommended report is **cohort-unified-agency**, which combines the two other reports so both are available for one data source. Click **Save**. File delivery typically begins within 24 hours.
  </Step>
</Steps>

## Connect AppsFlyer Cohort

<Steps>
  <Step title="Authorize access to the S3 bucket">
    On the **Data Sources** page, search for **AppsFlyer Cohort** and select it. Fill in the required fields: **AWS Access Key**, **AWS Secret**, **AWS Region**, **S3 Bucket** (name only, no `s3://` prefix), and **Directory Path** (the root containing the date-named subfolders, for example `appsflyer/cohort_unified/myapp/`). Click **Submit** to authenticate.
  </Step>

  <Step title="Select the app">
    On the data source settings, choose the **App** or apps from the dropdown.
  </Step>

  <Step title="Set the cohort alignment">
    Choose the **Cohort Alignment**: **First conversion date** or **Event date**. This determines how data is aggregated for this data source.
  </Step>

  <Step title="Select breakdowns and submit">
    Choose the breakdowns to expose. Only the columns selected during data source creation are available for this data source. Optionally set an identifiable **Name**, then click **Submit** to complete the connection. The first sync downloads all available history from S3 and can take up to one business day, longer for larger buckets.
  </Step>
</Steps>

## What gets imported

The data source imports cohort retention and revenue in USD at daily granularity, with cohort periods spanning day 0 through day 360 (0, 1, 3, 7, 14, 30, 45, 60, 90, 180, and 360). Per event, it exposes point-in-time and cumulative counts, revenue, and unique users. The cache refreshes twice daily.

For the complete metric list, cohort period semantics, report template details, and breakdown availability, see the [AppsFlyer Cohort data reference](/data-sources/a-f/appsflyer-cohort/data-reference).

## Troubleshooting

<AccordionGroup>
  <Accordion title="Error: given directory is empty or does not contain date folders">
    The configured directory has no subfolders whose last 10 characters parse as ISO dates. Confirm with AppsFlyer that Data Locker exports are flowing, and verify the directory path matches the bucket layout.
  </Accordion>

  <Accordion title="The first sync is slow">
    This is expected. The first sync downloads every cohort file from the bucket, so a bucket with a year or more of history can take 30 minutes or longer. Subsequent syncs are incremental.
  </Accordion>

  <Accordion title="Sync keeps retrying">
    Persistent failures usually mean the IAM user has lost access or the bucket structure has changed. Verify the IAM policy still grants read access on the bucket and directory, then trigger a manual refresh.
  </Accordion>

  <Accordion title="Revenue appears in USD instead of local currency">
    AppsFlyer's `cohort_unified` export normalizes revenue to USD before writing to S3, and the data source does not reconvert. For local-currency revenue, use the standard AppsFlyer data source.
  </Accordion>

  <Accordion title="An event is missing from the metric picker">
    Events are discovered from the actual S3 data. If an event has not fired for any user, it does not appear. Wait for the event to land in S3, then edit the data source to refresh the available list.
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="AppsFlyer Cohort data reference" href="/data-sources/a-f/appsflyer-cohort/data-reference">
    Metrics, cohort period semantics, and limits for AppsFlyer Cohort.
  </Card>

  <Card title="AppsFlyer Cohort FAQs" href="/data-sources/a-f/appsflyer-cohort/faqs">
    Common questions and expected behaviors for the AppsFlyer Cohort data source.
  </Card>

  <Card title="How to connect AppsFlyer" href="/data-sources/a-f/appsflyer/how-to-connect">
    Connect the standard AppsFlyer data source for install and event totals.
  </Card>

  <Card title="How to connect Amazon S3" href="/data-sources/a-f/amazon-s3/how-to-connect">
    Provision IAM read access to the S3 bucket holding the exports.
  </Card>
</CardGroup>
