In-app purchases
A mobile app can earn revenue from ad impressions (Ad Revenue) and in-app purchases (IAP Revenue).
AppMetrica allows you to collect information about purchases in the app and track statistics in the Revenue report. For more information, see Sending in-app purchases on Android and iOS.
- Automatic tracking of in-app purchases
- Tracking metrics
- Currency conversion
- Validating purchases
- Grouping purchases
- Debugging Revenue sending
- Paid subscriptions in the App Store
Automatic tracking of in-app purchases
For iOS and Android, starting with SDK version 4.0, automatic data collection for in-app purchases is available. To enable and disable automatic collection, use the SDK method withRevenueAutoTrackingEnabled for Android and the revenueAutoTrackingEnabled ( Objective-C | Swift ) property for iOS.
If your app has manual collection of purchases set up and automatic collection enabled, then you can choose which data on purchases to show in reports in the AppMetrica settings in the Revenue section: collected manually, automatically collected, or both.
Changing these settings does not affect data collection itself. After you change these settings, the data in the reports for previous periods will also change.
Tracking metrics
Currency conversion
In-app purchases can be made in different currencies. For a list of all supported currencies, see Supported currencies.
AppMetrica converts the purchase price to all report currencies: USD, EUR, RUB. AppMetrica uses an exchange rate that is provided from more than 15 sources, including the European Central Bank.
AppMetrica converts the currency using the previous day rate. For example, if the purchase was made on day N, the purchase price is converted at the exchange rate of day N − 1. Conversion takes place into EUR and RUB against USD.
Validating purchases
AppMetrica supports the revenue validation for purchases made through the App Store or Google Play. Purchases on iOS are validated using the iTunes API and on Android through local validation using a public key.
To validate purchases, you need to add keys in the AppMetrica settings and configure sending additional information along with Revenue. For more information, see Sending in-app purchases on Android and iOS.
- The report shows purchases that were validated or sent without any information for validation.
- All In-App Revenue metrics are counted based on validated purchases and purchases passed without parameters for validation.
- For invalid purchases, Invalid revenue and Users with invalid revenue metrics are counted.
Grouping purchases
In-app purchases are grouped by OrderID.
- On iOS — transactionIdentifier. It's generated by the StoreKit library.
- On Android — OrderId. It's generated by the Google Play Billing library.
You can set OrderID manually for purchases without validation. It should be passed in the payload field. For more information, see Sending in-app purchases on Android and iOS.
If you don't pass OrderID , the AppMetrica SDK generates the ID automatically.
Debugging Revenue sending
AppMetrica doesn't let you segment Revenue into “test” and “not test”. If you use the main API key for debugging purchases, the test purchases are included in general statistics. Therefore, to debug Revenue sending, send statistics to an additional API key using a reporter.For more information, see Sending in-app purchases on Android and iOS.