Skip to main content

Importing historical data to Adapty

After installing the Adapty SDK and releasing your app, you can access your users and subscribers in the Profiles section. But what if you have legacy infrastructure and need to migrate to Adapty, or simply want to see your existing data in Adapty?

note

Data import is not mandatory

Adapty will automatically grant access levels to historical users and restore their purchase events once they open the app with the Adapty SDK integrated. For this use case, importing historical data is not necessary. However, importing data ensures precise analytics if you have a significant number of historical transactions, although it is generally not required for migration.

To import data to Adapty:

  1. Export your transactions to a CSV file (separate files should be provided for iOS, Android, and Stripe). Please refer to the Import file format section below for detailed requirements.
  2. If any file exceeds 1 GB, prepare a data sample with approximately 100 lines.
  3. Upload all the files to Google Drive (you can compress them, but keep them separate).
  4. For iOS transactions, ensure the In-app purchase API section in the App settingsis filled out with the Issuer ID, Key ID, and the Private key (.P8 file) even if you use the StoreKit 1. See the Provide Issuer ID and Key ID and Upload In-App Purchase Key file sections for detailed instructions.
  5. Share the links with our team via email or through the online chat in the Adapty Dashboard.

Do not worry, importing historical data will not create duplicates, even if that data overlaps with existing entries in Adapty.

Known limitations for Android

  1. Only active subscriptions will be restored; expired transactions will not be.
  2. Only the latest renewals in a subscription will be restored; the entire chain of purchases will not be.
  3. If the product price has changed since the purchase, the current price will be used, which may result in incorrect pricing.

Import file format

Please prepare your data in a file or files that meet the following rules:

  • The file format is .CSV.
  • Separate files for Android, iOS, and Stripe imports.
  • Every import file contains all required columns.
  • The columns in the import file(s) have headers.
  • The column headers are exactly as in the Column name column in the table below. Please check for typos.
  • Columns that are not required can be absent from the file. Don't add empty columns for data you don't have.
  • Import files should not have extra columns not mentioned in the table. If present, please delete them.
  • Values are separated by commas.
  • Values are not enclosed in quotes.
  • If there are several apple_original_transaction_id's for one user, add all of them as separate lines for each apple_original_transaction_id. Otherwise, we may not be able to restore consumable purchases.

Please use the following files as samples for iOS and Android.

Available import file columns

Column namePresenceDescription
user_idrequiredID of your user
apple_original_transaction_idrequired for iOS

The original transaction ID or OTID (learn more ), used in StoreKit 2 import mechanism. As one user can have multiple OTIDs, it is enough to provide at least one for successful import.

Note: We require In-app purchase API credentials for this import to be set up in your Adapty Dashboard. Learn how to do it here .

google_product_idrequired for GoogleProduct ID in the Google Play Store.
google_purchase_tokenrequired for GoogleA unique identifier that represents the user and the product ID for the in-app product they purchased
google_is_subscriptionrequired for GooglePossible values are 1 | 0
stripe_tokenrequired for StripeToken of a Stripe object that represents a unique purchase. Could either be a token of Stripe's Subscription (sub_...) or Payment Intent (pi_...).
subscription_expiration_dateoptionalThe date of subscription expiration, i.g. next charging date, date, and time with timezone (2020-12-31T23:59:59-06:00)
created_atoptionalDate and time of profile creation (2019-12-31 23:59:59-06:00)
birthdayoptionalThe birthday of the user in format 2000-12-31
emailoptionalThe e-mail of your user
genderoptionalThe gender of the user
phone_numberoptionalThe phone number of your user
countryoptionalformat ISO 3166-1 alpha-2
first_nameoptionalThe first name of your user
last_nameoptionalThe last name of your user
last_seenoptionalThe date and time with timezone (2020-12-31T23:59:59-06:00)
idfaoptionalThe identifier for advertisers (IDFA) is a random device identifier assigned by Apple to a user's device. Applicable to iOS apps only
idfvoptionalThe identifier for vendors (IDFV) is a unique code assigned to all apps developed by a single developer, which in this case refers to your apps. Applicable to iOS apps only
advertising_idoptionalThe Advertising ID is a unique code assigned by the Android Operating System that advertisers might use to uniquely identify a user's device
amplitude_user_idoptionalThe user ID from Amplitude
amplitude_device_idoptionalThe device ID from Amplitude
mixpanel_user_idoptionalUser ID from Mixpanel
appmetrica_profile_idoptionalUser profile ID from AppMetrica
appmetrica_device_idoptionalThe device ID from AppMetrica
appsflyer_idoptionalUnique identifier from AppsFlyer
adjust_device_idoptionalThe device ID from Adjust
facebook_anonymous_idoptionalA unique identifier generated by Facebook for users who interact with your app or website anonymously, meaning they are not logged into Facebook
branch_idoptionalUnique identifier from Branch
attribution_sourceoptionalThe source integration of the attribution, for example, appsflyer
attribution_statusoptionalorganic
attribution_channeloptionalThe attribution channel that brought the transaction
attribution_campaignoptionalThe attribution campaign that brought the transaction
attribution_ad_groupoptionalThe attribution ad group that brought the transaction
attribution_ad_setoptionalThe attribution ad set that brought the transaction
attribution_creativeoptionalSpecific visual or textual elements used in an advertisement or marketing campaign that are tracked to determine their effectiveness in driving desired actions, such as clicks, conversions, or installs
custom_attributesoptionalDefine up to 30 custom attributes as a JSON dictionary in key-value format:
  • key: (string) The name of the custom attribute
  • value: (string, integer, float, or boolean) The value of the custom attribute.

Format: "{'string_value': 'some_value', 'float_value': 123.0, 'int_value': 456}".

Note the use of double and single quotes in the format. Keep in mind that Boolean values will be converted to strings.

Required Fields

There are 2 groups of required fields for each platform: user_id and data identifying purchases specific to the corresponding platform. Refer to the table below for the mandatory fields per platform.

PlatformRequired fields
iOS

user_id

apple_original_transaction_id

Android

user_id

google_product_id

google_purchase_token

google_is_subscription

Stripe

user_id

stripe_token

Without these fields, Adapty won't be able to fetch transactions.

For precise cohort analytics, please specify created_at. If not provided, we will assume the install date to be the same as the first purchase date.

Import data to Adapty

Please contact us and share your import files via [email protected] or through the online chat in the Adapty Dashboard.