Automated iOS In-App-Purchase Tracking

Last Updated: Jan 17, 2016 10:26PM PST

Apsalar's latest SDKs will automatically track revenue for in-app purchases from the Apple App Store. Once you've integrated our iOS SDK, version 5.0.0 or greater, you can immediately begin to:

  • Track revenue and product information for in-app purchases
  • Display revenue earned after Apple’s commission
  • Attribute in-app purchase revenue to users’ lifetime value (LTV)
  • Tie revenue to applicable campaign sources
  • Convert revenue from international app stores to a single account currency (see Account Currency)
  • Verify all in-app purchase receipts with Apple to ensure validity of the transaction 

How it works

  • The Apsalar iOS SDK implements methods to pass in-app purchase name, price and currency information after a successful transaction. 
  • The transaction receipt is verified with Apple to ensure it is a valid transaction.
    • If the transaction is invalid, it will be stored as an event with the name “Invalid IAP”, with the error code stored under the attribute “Validation Status”. This will allow you to track invalid transactions, and create segments for users initiating these transactions.
  • Valid in-app purchases are converted using a daily currency exchange rate to your account's designated currency. 
  • A multiplier appropriate to the In-App Purchase region is applied to the converted price to account for Apple App Store commission. The default multiplier is 70%.
    • For the Apple App Store, developer proceeds are sometimes lower than 70% since Apple accounts for different tax rates by country. Apsalar automatically adjusts for the different revenue shares Apple has for each country.
  • The adjusted revenue value is stored and available in all applicable reports.

Supported Revenue Types

Apple currently has four revenue types for In-App Purchases:
  • Consumable
  • Non-Consumable
  • Non-Renewing Subscriptions
  • Auto-Renewable Subscriptions
Apsalar's automated In-App-Purchase Tracking supports Consumable, Non-Consumable, and Non-Renewing Subscriptions.

Unfortunately it does not support Auto-Renewable Subscriptions. Due to the recurrent nature of these charges, Apple added additional security measures to verify this type of purchase which require secure information from your individual Apple iTunes account. This prevents Apsalar, and other Measurement Companies, from verifying and reporting this type of revenue.

We are continually looking for a solution to this restriction and hope to support Auto-Renewable Subscriptions automatically in the future.

Receipt Validation

In-app purchases on the Apple App Store are prone to piracy. Apsalar has utilized Apple's API for validating in-app purchase receipts to in order to identify pirated in-app purchases. To report accurate revenues for iOS applications, Apsalar now validates all transactions with Apple before attributing the revenue to an account. Depending on the transaction you may see one of the following Status codes: 
Status code  Description 
 0  Receipt is valid
 21000  The App Store could not read the JSON object you provided.
 21002  The data in the receipt-data property was malformed. 
 21003  The receipt could not be authenticated. 
 21005   The receipt server is not currently available.
 Any other value   Receipt is not valid   

Events Created by Automated iOS In-App-Purchase Tracking

Automated iOS In-App-Purchase tracking will automatically generate the one of the following three events for each IAP that occurs in your application:
  • IAP Revenue (Automated) - Transactions that have passed receipt validation. Revenue from these events is recorded in relevant reports.
  • Test IAP - Transactions generated while using an iTunes Connect Test User account. Revenue reported from these events is not recorded as revenue for your application, but the revenue value is still viewable as an attribute for the event.
  • Invalid IAP - Transactions that have failed receipt validation. Revenue reported from these events is not recorded as revenue for your application, but the revenue value and status code are still viewable as attributes for the event.

Disabling Automated iOS In-App-Purchase Tracking

If disabled, Apsalar's iOS SDK will no longer automatically track, convert, or report your Apple App Store In-App-Purchases.

To disable Automated iOS In-App-Purchase tracking, use the following method in your application's code:
[Apsalar setAllowAutoIAPComplete:(BOOL)boolean];
If you've disabled automated iOS In-App-Purchase Tracking, but would still like to track iOS In-App-Purchases manually, you can utilize one of the following methods, after a completed In-App-Purchase transaction in your application:
[Apsalar iapComplete:(id)transaction];
[Apsalar iapComplete:(id)transaction withAttributes:(id)value, (id)key, ...];

In this code, transaction is the SKPaymentTransaction object for the completed In-App Purchase, and key/value pairs are optional custom event attributes. 

Please note the following keys are protected and cannot be passed as custom event attributes when using the iapComplete method:

  • ps
  • pk
  • pn
  • pt
  • pcc
  • pp
  • r
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found