Amazon S3

Learn how to set up Amazon S3 export

Adapty's integration with Amazon S3 allows you to store event and paywall visit data securely in one central location. You will be able to save your subscription events to your Amazon S3 bucket as .csv files.
To set up this integration, you will need to follow a few simple steps in the AWS Console and Adapty dashboard.

📘

Schedule

Adapty sends your data every 24h at 4:00 UTC.

Each file will contain data for the events created for the entire previous calendar day in UTC. For example, the data exported automatically at 4:00 UTC on March 8th will contain all the events created on March 7th from 00:00:00 to 23:59:59 in UTC.

How to set up Amazon S3 integration

To start receiving data, you'll need the following credentials:

  1. Access key ID
  2. Secret access key
  3. S3 bucket name
  4. Folder name inside the S3 bucket

📘

Nested directories

You can specify nested directories in the Amazon S3 bucket name field, e.g. adapty-events/com.sample-app

To integrate Amazon S3 go to Integrations -> Amazon S3, turn on a toggle from off to on, and fill out fields.

First of all set credentials to build a connection between Amazon S3 and Adapty profiles.

Amazon S3 - Photo 1

Adapty Dashboard - Amazon S3 Integration

In the Adapty Dashboard, the following fields are needed to set up the connection:

FieldDescription
Access Key IDA unique identifier that is used to authenticate a user or application's access to an AWS service. Find this ID in the downloaded csv file .
Secret Access KeyA private key that is used in conjunction with the Access Key ID to authenticate a user or application's access to an AWS service. Find this Key in the downloaded csv file .
S3 Bucket Name A globally unique name that identifies a specific S3 bucket within the AWS cloud. S3 buckets are a simple storage service that allows users to store and retrieve data objects, such as files and images, in the cloud.
Folder Inside the BuckerThe name of the folder that you want to have inside the selected S3 bucket. Please note that S3 simulates folders using object key prefixes, which are essentially folder names.

How to create Amazon S3 credentials

This guide will help you create the necessary credentials in your AWS Console.

1. Create Access Policy

First, navigate to the IAM Policy Dashboard in your AWS Console and select the option to Create Policy.

Amazon S3 - Photo 2

AWS IAM- Create Policy

In the Policy editor, paste the following JSON and change adapty-s3-integration-test to your bucket name:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowListObjectsInBucket",
            "Effect": "Allow",
            "Action": "s3:ListBucket",
            "Resource": "arn:aws:s3:::adapty-s3-integration-test"
        },
        {
            "Sid": "AllowAllObjectActions",
            "Effect": "Allow",
            "Action": "s3:*Object",
            "Resource": [
                "arn:aws:s3:::adapty-s3-integration-test/*",
                "arn:aws:s3:::adapty-s3-integration-test"
            ]
        },
        {
            "Sid": "AllowBucketLocation",
            "Effect": "Allow",
            "Action": "s3:GetBucketLocation",
            "Resource": "arn:aws:s3:::adapty-s3-integration-test"
        }
    ]
}
Amazon S3 - Photo 3

AWS IAM - JSON Policy

After completing the policy configuration, you may choose to add tags (optional) and then click Next to proceed to the final step. In this step, you will name your policy and simply click on the Create policy button to finalize the creation process.

Amazon S3 - Photo 4

AWS IAM - Name the Policy

2. Create IAM user

To enable Adapty to upload raw data reports to your bucket, you will need to provide them with the Access Key ID and Secret Access Key for a user who has write access to the specific bucket.

To proceed with that, navigate to the IAM Console and select the Users section. From there, click on the Add users button.

Amazon S3 - Photo 5

AWS IAM- Add User

Give the user a name, choose Access key – Programmatic access, and proceed to permissions.

Amazon S3 - Photo 6

AWS IAM- Name User

For the next step, please select the Add user to group option and then click the Create group button.

Amazon S3 - Photo 7

AWS IAM - Create Group

Next, you need to assign a name to your User Group and select the policy that was previously created by you. Once you have selected the policy, click on the Create group button to complete the process.

Amazon S3 - Photo 8

AWS IAM - Add Permission to Group

After successfully creating the group, please select it and proceed to the next step.

Amazon S3 - Photo 9

AWS IAM - Select Policy for Group

Since this is the final step for this section, you may proceed by simply clicking on the Create User button.

Amazon S3 - Photo 10

AWS IAM - Create User

Lastly, you can either download the credentials in .csv format or alternatively, copy and paste the credentials directly from the dashboard.

Amazon S3 - Photo 11

AWS IAM - download .csv

Manual data export

In addition to the automatic event data export to Amazon S3, Adapty also provides a manual file export functionality. With this feature, you can select a specific time interval for the event data and export it to your S3 bucket manually. This allows you to have greater control over the data you export and when you export it.

The specified date range will be used to export the events created from Date A 00:00:00 UTC up to Date B 23:59:59 UTC.

Amazon S3 - Photo 12

Manual Export - Amazon S3

Table structure

In AWS S3 integration, Adapty provides a table to store historical data for transaction events and paywall visits. The table contains information about the user profile, revenue and proceeds, and the origin store, among other data points. Essentially, these tables log all transactions generated by an app for a given time period.

🚧

Note that this structure may grow over time — with new data being introduced by us or by the 3rd parties we work with. Make sure that your code that processes it is robust enough and relies on the specific fields, but not on the structure as a whole.

Here is the table structure for the events:

ColumnDescription
profile_idAdapty user ID.
event_typeLower cased event name. Refer to the Events section to learn event types.
event_datetimeISO 8601 date.
transaction_idA unique identifier for a transaction such as a purchase or renewal.
original_transaction_idThe transaction identifier of the original purchase.
subscription_expires_atThe Expiration date of subscription. Usually in the future.
environmentCould be Sandbox or Production.
revenue_usdRevenue in USD. Can be empty.
proceeds_usdProceeds in USD. Can be empty.
net_revenue_usdNet revenue (income after taxes) in USD. Can be empty.
tax_amount_usdAmount of money deducted for taxes in USD. Can be empty.
revenue_localRevenue in local currency. Can be empty.
proceeds_localProceeds in local currency. Can be empty.
net_revenue_localNet revenue (income after taxes) in local currency. Can be empty.
tax_amount_localAmount of money deducted for taxes in local currency. Can be empty.
customer_user_idDeveloper user ID. For example, it can be your user UUID, email, or any other ID. Null if you didn't set it.
storeCould be app_store or play_store.
product_idProduct ID in the Apple App Store, Google Play Store, or Stripe.
base_plan_idBase plan ID in the Google Play Store or price ID in Stripe.
developer_idDeveloper (SDK) ID of the paywall where the transaction originated.
ab_test_nameName of the A/B test where the transaction originated.
ab_test_revisionRevision of the A/B test where the transaction originated.
paywall_nameName of the paywall where the transaction originated.
paywall_revisionRevision of the paywall where the transaction originated.
profile_countyProfile Country determined by Adapty, based on IP.
install_dateISO 8601 date when the installation happened.
idfvidentifierForVendor on iOS devices
idfaadvertisingIdentifier on iOS devices
currencyThe 3-letter currency code (ISO-4217) of the transaction.
store_countryProfile Country determined by Apple/Google store.
attribution_sourceAttribution source.
attribution_network_user_idID assigned to the user by attribution source.
attribution_statusCan be organic, non_organic or unknown
attribution_channelMarketing channel name.
attribution_campaignMarketing campaign name.
attribution_ad_groupAttribution ad group.
attribution_ad_setAttribution ad set.
attribution_creativeAttribution creative keyword.

Here is the table structure for the paywall visits:

ColumnDescription
profile_idAdapty user ID.
customer_user_idDeveloper user ID. For example, it can be your user UUID, email, or any other ID. Null if you didn't set it.
profile_countryProfile Country determined by Apple/Google store.
install_dateISO 8601 date when the installation happened.
storeCould be app_store or play_store.
paywall_showed_atThe date when the paywall has been displayed to the customer.
developer_idDeveloper (SDK) ID of the paywall where the transaction originated.
ab_test_nameName of the A/B test where the transaction originated.
ab_test_revisionRevision of the A/B test where the transaction originated.
paywall_nameName of the paywall where the transaction originated.
paywall_revisionRevision of the paywall where the transaction originated.

Events and tags

Below the credentials, there are three groups of events you can export, send, and store in Amazon S3 from Adapty. Simply turn on the ones you need. Check the full list of the events offered by Adapty here.

Subscriptions, trials, issues events in Adapty integration interface

Subscriptions, trials, issues events in Adapty integration interface