Skip to content

Commit d1188a4

Browse files
committed
README update
1 parent 234fc27 commit d1188a4

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ This is the Flutter SDK of Adjust™. You can read more about Adjust™ at [adju
5151

5252
### Additional features
5353

54+
* [Subscription tracking](#af-subscription-tracking)
5455
* [Push token (uninstall tracking)](#af-push-token)
5556
* [Attribution callback](#af-attribution-callback)
5657
* [Session and event callbacks](#af-session-event-callbacks)
@@ -595,6 +596,109 @@ In this case, this will make the Adjust SDK not send the initial install session
595596

596597
Once you have integrated the Adjust SDK into your project, you can take advantage of the following features.
597598

599+
### <a id="af-subscription-tracking"></a>Subscription tracking
600+
601+
**Note**: This feature is only available in the SDK v4.22.0 and above.
602+
603+
You can track App Store and Play Store subscriptions and verify their validity with the Adjust SDK. After a subscription has been successfully purchased, make the following call to the Adjust SDK:
604+
605+
**For App Store subscription:**
606+
607+
```dart
608+
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
609+
price,
610+
currency,
611+
transactionId,
612+
receipt);
613+
subscription.setTransactionDate(transactionDate);
614+
subscription.setSalesRegion(salesRegion);
615+
616+
Adjust.trackAppStoreSubscription(subscription);
617+
```
618+
619+
**For Play Store subscription:**
620+
621+
```dart
622+
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription(
623+
price,
624+
currency,
625+
sku,
626+
orderId,
627+
signature,
628+
purchaseToken);
629+
subscription.setPurchaseTime(purchaseTime);
630+
631+
Adjust.trackPlayStoreSubscription(subscription);
632+
```
633+
634+
Subscription tracking parameters for App Store subscription:
635+
636+
- [price](https://developer.apple.com/documentation/storekit/skproduct/1506094-price?language=objc)
637+
- currency (you need to pass [currencyCode](https://developer.apple.com/documentation/foundation/nslocale/1642836-currencycode?language=objc) of the [priceLocale](https://developer.apple.com/documentation/storekit/skproduct/1506145-pricelocale?language=objc) object)
638+
- [transactionId](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier?language=objc)
639+
- [receipt](https://developer.apple.com/documentation/foundation/nsbundle/1407276-appstorereceipturl)
640+
- [transactionDate](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411273-transactiondate?language=objc)
641+
- salesRegion (you need to pass [countryCode](https://developer.apple.com/documentation/foundation/nslocale/1643060-countrycode?language=objc) of the [priceLocale](https://developer.apple.com/documentation/storekit/skproduct/1506145-pricelocale?language=objc) object)
642+
643+
Subscription tracking parameters for Play Store subscription:
644+
645+
- [price](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpriceamountmicros)
646+
- [currency](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpricecurrencycode)
647+
- [sku](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsku)
648+
- [orderId](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getorderid)
649+
- [signature](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsignature)
650+
- [purchaseToken](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetoken)
651+
- [purchaseTime](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetime)
652+
653+
**Note:** Subscription tracking API offered by Adjust SDK expects all parameters to be passed as `string` values. Parameters described above are the ones which API exects you to pass to subscription object prior to tracking subscription. There are various libraries which are handling in app purchases in Flutter and each one of them should return information described above in some form upon successfully completed subscription purchase. You should locate where these parameters are placed in response you are getting from library you are using for in app purchases, extract those values and pass them to Adjust API as string values.
654+
655+
Just like with event tracking, you can attach callback and partner parameters to the subscription object as well:
656+
657+
**For App Store subscription:**
658+
659+
```dart
660+
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
661+
price,
662+
currency,
663+
transactionId,
664+
receipt);
665+
subscription.setTransactionDate(transactionDate);
666+
subscription.setSalesRegion(salesRegion);
667+
668+
// add callback parameters
669+
subscription.addCallbackParameter('key', 'value');
670+
subscription.addCallbackParameter('foo', 'bar');
671+
672+
// add partner parameters
673+
subscription.addPartnerParameter('key', 'value');
674+
subscription.addPartnerParameter('foo', 'bar');
675+
676+
Adjust.trackAppStoreSubscription(subscription);
677+
```
678+
679+
**For Play Store subscription:**
680+
681+
```dart
682+
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription(
683+
price,
684+
currency,
685+
sku,
686+
orderId,
687+
signature,
688+
purchaseToken);
689+
subscription.setPurchaseTime(purchaseTime);
690+
691+
// add callback parameters
692+
subscription.addCallbackParameter('key', 'value');
693+
subscription.addCallbackParameter('foo', 'bar');
694+
695+
// add partner parameters
696+
subscription.addPartnerParameter('key', 'value');
697+
subscription.addPartnerParameter('foo', 'bar');
698+
699+
Adjust.trackPlayStoreSubscription(subscription);
700+
```
701+
598702
### <a id="af-push-token"></a>Push token (uninstall tracking)
599703

600704
Push tokens are used for Audience Builder and client callbacks, and they are required for uninstall and reinstall tracking.

0 commit comments

Comments
 (0)