API Connector Documentation
Import AppsFlyer Data to Google Sheets
In this guide, we’ll walk through how to pull data from the AppsFlyer Cohort Reporting API directly into Google Sheets, using the API Connector add-on.
We'll first get an API token from AppsFlyer, and then set up a request to pull in metrics to your spreadsheet.
Contents
- Before You Begin
- Part 1: Get your AppsFlyer API Token
- Part 2: Pull AppsFlyer API Data into Sheets
- Part 3: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get Your AppsFlyer API Token
- Reach out to your CSM to enable the Cohort API
- Get the token in the dashboard as shown here:
- From the menu bar, access the user menu (email address drop-down).
- Select Security center.
- In the AppsFlyer API tokens section, click Manage your AppsFlyer API tokens.
- The available tokens (V1.0, V2.0, or both) are displayed.
- Copy the required token.
Part 2: Pull AppsFlyer API Data into Sheets
For this example API request, we'll fetch data about a cohort. Where it says your_token
, enter the token you retrieved above, and where it says your_app_id
, substitute in your own app ID. The app ID is the ID in the URL of a store's app page. For Android, this will look like com.coolcompany.coolapp, while for iOS it will look something like id123456789. Here's an example request setup:
- Open up Google Sheets and click Extensions > API Connector > Open > Create request.
- In the request form enter the following:
- Application:
Custom
- Method:
POST
- Request URL:
https://hq1.appsflyer.com/api/cohorts/v1/data/app/your_app_id?format=json
- OAuth:
None
- Headers:
Authorization
:Bearer your_token
Accept
:application/json
Content-Type
:application/json
- Request body:
{"cohort_type":"unified","min_cohort_size":1,"preferred_timezone":true,"from":"2022-12-01","to":"2022-12-31","filters":{"period":[30],"pid":["Facebook Ads"]},"preferred_currency":true,"aggregation_type":"cumulative","per_user":false,"partial_data":true,"groupings":["date","pid"],"kpis":["sessions"]}
- Application:
- Create a new tab and click Set current to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see Appsflyer cohort data populate your sheet.
Part 3: API Documentation
Official API documentation: https://support.appsflyer.com/hc/en-us/articles/360004799057-Cohort-API#cohort-reporting-api
Thanks for all the details, Ana. The main pain point of the Cohort API is that it has a limit of 60 days in total. So, we have to change our query every 2 months. Is there a way to overcome this limitation?
How about setting your request body so it references a cell that contains a dynamic date? That way you don't need to update it manually. I think something like this would work:
1) create a helper sheet called DateInput that takes the maximum date from the prior response, e.g.
=max(Cohorts!P:P)
2) convert that date into the format required by AppsFlyer, e.g.
=text(B2,"yyyy-mm-dd")
. This will be the start date of your new query.3) create a second date cell that adds 60 days (or whatever range you want) to your start date. Again you'll need to make sure it's in the right format, e.g.
=text(C2+60,"yyyy-mm-dd")
4) now adjust your request body to use these cells, e.g.
"from": "+++DateInput!C2+++", "to": "+++DateInput!C3+++"
You won't need to adjust your request again since it's automatically fetching the last date in your sheet and using it as the start date.
If there is another article to show how to import data from adjust.com to google sheet, that will be good !
Hey J, you can check the documentation on their site for info on how to connect. For example, this article shows how to get your token: https://help.adjust.com/en/article/report-service-api-authentication. They provide examples and info about where to put the token (in the headers section), as well as curl snippets that you can import into API Connector using the curl import tool.