Segmenting your users by their spending activity is one of the Tapjoy SDK’s most powerful features. For example, you might want to show advertisements to your non-spending users, but show In App Purchase promotions to your "whale" users. In order to use this feature, you must let Tapjoy know about the spending activity of your users. You do this with the [Tapjoy trackPurchase] call. The following is an example for the purchase of a "SWORD" item for 0.99 USD:
[Tapjoy trackPurchase:@"SWORD" currencyCode:@"USD" price:0.99 campaignId:nil transactionId:transaction_id];
The currency codes used follow the ISO 4217 standard.
The campaignId can be any string you wish to use to identify the campaign that triggered the purchase.
The TransactionID should be the receipt generated by the iTunes IAP purchase process.
If you are logged on to your Tapjoy account there is a link that provides a code example. The code is also listed below.
The following is an example for the purchase of a "SWORD" item for 0.99 USD:
-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *trans in transactions) {
NSString *transaction_id = nil;
switch (trans.transactionState)
{
case SKPaymentTransactionStatePurchased:
// get transaction_id here which refers to the receipt generated by the iTunes IAP purchase process
transaction_id = trans.transactionIdentifier;
[[SKPaymentQueue defaultQueue] finishTransaction: trans];
//Remove empty transaction IDs
if(transaction_id == nil || [transaction_id isEqualToString:@""])
transaction_id = @"Empty_Transaction_ID";
// call Tapjoy trackPurchase here
[Tapjoy trackPurchase:@"SWORD" currencyCode:@"USD" price:0.99 campaignId:nil transactionId:transaction_id];
}
}
}
Verifying In-App Purchase is important in purchase tracking. Tapjoy provides an interface for Validating Receipts Locally. If you don’t use receipt validation, it is almost certain that your metrics and segmentation will be distorted by fraudulent purchases.
Once purchase tracking is implemented, you will be able to see charts in the "IAP Revenue" section of the Analytics dashboard:
VERY IMPORTANT: You should either include the IAP purchase receipt (in form of TransactionID parameter) with your Tapjoy IAP tracking call (for SDK versions 11.2.0 or higher), or verify that a given In-App Purchase is valid using Apple’s receipt validation measures before reporting it to Tapjoy. If you do not do this, it is almost certain that your metrics and segmentation will be distorted by fraudulent purchases. This will break numerous Tapjoy capabilities, including the Future Value Map and the ability to target (or exclude) high-spending users with certain kinds of content.
The growth of IAP in freemium apps highlights a critical need for app developers to verify each purchase and guard against fraud. We highly suggest that you use receipt validation in your applications to prevent unauthorized transactions from contaminating your data. That way, you are incorporating valid (and only valid) purchases into your mobile analytics data. If you do not include a receipt parameter, we will assume that you did the receipt validation on your own and accept the purchase as valid.
Using IAP Receipt Verification and tracking your data on the Tapjoy Dashboard is simple and requires a minimal amount of work for app publishers.
You only need to make one single IAP tracking call for each purchase a user makes. By including the TransactionID parameter, you will eliminate revenue from fraudulent purchases showing up in your dashboard and will ensure that the IAP analytics remain accurate. You can pass the Apple or Google store receipt as TransactionID, along with your Tapjoy IAP tracking call, and Tapjoy’s servers will verify that the transaction is valid before adding it to your dashboard data.
Once you’ve completed receipt validation, you can confidently look at your data set, and Tapjoy’s Future Value Map, and target spenders with IAP promotions and non-spenders with ads in order to truly drive LTV from your users.