Skip to content

Commit af5398c

Browse files
committed
README update
1 parent ce4831d commit af5398c

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
@@ -60,6 +60,7 @@ Read this in other languages: [English][en-readme], [中文][zh-readme], [日本
6060
* [Push token (uninstall tracking)](#ad-push-token)
6161
* [Attribution callback](#ad-attribution-callback)
6262
* [Ad revenue tracking](#ad-ad-revenue)
63+
* [Subscription tracking](#ad-subscriptions)
6364
* [Session and event callbacks](#ad-session-event-callbacks)
6465
* [User attribution](#ad-user-attribution)
6566
* [Device IDs](#ad-device-ids)
@@ -592,6 +593,109 @@ Currently we support the following `source` parameter values:
592593

593594
- `AdjustConfig.AdjustAdRevenueSourceMopub` - represents the [MoPub mediation platform][sdk2sdk-mopub]
594595

596+
### <a id="af-subscriptions"></a>Subscription tracking
597+
598+
**Note**: This feature is only available in the SDK v4.22.0 and above.
599+
600+
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:
601+
602+
**For App Store subscription:**
603+
604+
```csharp
605+
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
606+
price,
607+
currency,
608+
transactionId,
609+
receipt);
610+
subscription.setTransactionDate(transactionDate);
611+
subscription.setSalesRegion(salesRegion);
612+
613+
Adjust.trackAppStoreSubscription(subscription);
614+
```
615+
616+
**For Play Store subscription:**
617+
618+
```csharp
619+
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription(
620+
price,
621+
currency,
622+
sku,
623+
orderId,
624+
signature,
625+
purchaseToken);
626+
subscription.setPurchaseTime(purchaseTime);
627+
628+
Adjust.trackPlayStoreSubscription(subscription);
629+
```
630+
631+
Subscription tracking parameters for App Store subscription:
632+
633+
- [price](https://developer.apple.com/documentation/storekit/skproduct/1506094-price?language=objc)
634+
- 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)
635+
- [transactionId](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier?language=objc)
636+
- [receipt](https://developer.apple.com/documentation/foundation/nsbundle/1407276-appstorereceipturl)
637+
- [transactionDate](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411273-transactiondate?language=objc)
638+
- 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)
639+
640+
Subscription tracking parameters for Play Store subscription:
641+
642+
- [price](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpriceamountmicros)
643+
- [currency](https://developer.android.com/reference/com/android/billingclient/api/SkuDetails#getpricecurrencycode)
644+
- [sku](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsku)
645+
- [orderId](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getorderid)
646+
- [signature](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getsignature)
647+
- [purchaseToken](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetoken)
648+
- [purchaseTime](https://developer.android.com/reference/com/android/billingclient/api/Purchase#getpurchasetime)
649+
650+
**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 Unity 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.
651+
652+
Just like with event tracking, you can attach callback and partner parameters to the subscription object as well:
653+
654+
**For App Store subscription:**
655+
656+
```csharp
657+
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
658+
price,
659+
currency,
660+
transactionId,
661+
receipt);
662+
subscription.setTransactionDate(transactionDate);
663+
subscription.setSalesRegion(salesRegion);
664+
665+
// add callback parameters
666+
subscription.addCallbackParameter("key", "value");
667+
subscription.addCallbackParameter("foo", "bar");
668+
669+
// add partner parameters
670+
subscription.addPartnerParameter("key", "value");
671+
subscription.addPartnerParameter("foo", "bar");
672+
673+
Adjust.trackAppStoreSubscription(subscription);
674+
```
675+
676+
**For Play Store subscription:**
677+
678+
```csharp
679+
AdjustPlayStoreSubscription subscription = new AdjustPlayStoreSubscription(
680+
price,
681+
currency,
682+
sku,
683+
orderId,
684+
signature,
685+
purchaseToken);
686+
subscription.setPurchaseTime(purchaseTime);
687+
688+
// add callback parameters
689+
subscription.addCallbackParameter("key", "value");
690+
subscription.addCallbackParameter("foo", "bar");
691+
692+
// add partner parameters
693+
subscription.addPartnerParameter("key", "value");
694+
subscription.addPartnerParameter("foo", "bar");
695+
696+
Adjust.trackPlayStoreSubscription(subscription);
697+
```
698+
595699
### <a id="ad-session-event-callbacks"></a>Session and event callbacks
596700

597701
You can set up callbacks to notify you of successful and failed events and/or sessions.

0 commit comments

Comments
 (0)