Track subscriptions

Warning:
Adjust no longer offers subscription recording for new customers. If you are already set up with subscription recording, reach out to your dedicated Technical Account Manager or support@adjust.com.
Important:
The following steps only set up subscription tracking within the Adjust SDK. To enable the feature, Adjust need to set up app-specific information. Please contact support@adjust.com or talk to your Technical Account manager to set this up.

You can track App Store subscriptions and verify their validity with the Adjust SDK. After the user purchases a subscription, create an ADJSubscription instance containing the details.

Note:
This feature is only available in Adjust SDK version v4.22.0 and above.

Create your subscription instance

To create an ADJSubscription instance, call the initWithPrice method. Pass the subscription information as parameters. Assign this object for later use.

Objective-C
Swift
ADJSubscription *subscription = [[ADJSubscription alloc] initWithPrice:price
                                                              currency:currency
                                                         transactionId:transactionId
                                                            andReceipt:receipt];

Parameters

To record the date of the subscription event, use the setTransactionDate method:

Objective-C
Swift
[subscription setTransactionDate:transactionDate];

If you want to capture the region of purchase, you can pass the appropriate country code to the setSalesRegion method.

Objective-C
Swift
[subscription setSalesRegion:salesRegion];

You can also pass callback parameters and partner parameters back to the Adjust backend using the addCallbackParameter and addPartnerParameter methods respectively.

Objective-C
Swift
[subscription addCallbackParameter:@"foo" value:@"bar"];
Objective-C
Swift
[subscription addPartnerParameter:@"foo" value:@"bar"];

Track your subscription

Once you have created your ADJSubscription instance, pass it to the trackSubscription method.

Objective-C
Swift
ADJSubscription *subscription = [[ADJSubscription alloc] initWithPrice:price
                                                              currency:currency
                                                         transactionId:transactionId
                                                            andReceipt:receipt];
[subscription setTransactionDate:transactionDate];
[subscription setSalesRegion:salesRegion];

// Add callback parameters
[subscription addCallbackParameter:@"foo" value:@"bar"];
[subscription addCallbackParameter:@"fizz" value:@"buzz"];

// Add partner parameters
[subscription addPartnerParameter:@"foo" value:@"bar"];
[subscription addPartnerParameter:@"fizz" value:@"buzz"];

[Adjust trackSubscription:subscription];