App StoreおよびPlay Storeのサブスクリプションを計測し、それぞれの有効性をAdjust SDKで確認できます。ユーザーがサブスクリプションの購入を完了したら、その詳細を含むAdjustAppStoreSubscription
またはAdjustPlayStoreSubscription
を作成してください。
1. サブスクリプションオブジェクトをインスタンス化する {#instantiate-a-subscription-object}
開始するには、サブスクリプション購入の詳細を含むサブスクリプションオブジェクトを作成する必要があります。
constructor(price: string, currency: string, transactionId: string)
以下のプロパティを含むAdjustAppStoreSubscription
オブジェクトを作成します。
|パラメーター |データタイプ |説明 |
| --------------- | --------- | -------------------------------------- -------------------------------------- -------------------------------------- -------------------------------------- -------------------------------------- -------------------------------------- | --- |
| price
| string
|サブスクリプションの価格 |
| currency
| string
|サブスクリプションの通貨。 currencyCode
オブジェクトのpriceLocale
としてフォーマット|
| transactionId
| string
| トランザクションのためのID| |
var subscription = new AdjustAppStoreSubscription(
Adjust.trackAppStoreSubscription(subscription);
constructor(price: string, currency: string, sku: string, orderId: string, signature: string, purchaseToken: string)
以下のプロパティを含むAdjustPlayStoreSubscription
オブジェクトを作成します。
パラメーター | データタイプ | 説明 |
---|
price | string | サブスクリプションの価格 |
currency | string | サブスクリプション通貨 |
sku | string | プロダクトID |
orderId | string | トランザクションID |
signature | string | 購入データのシグネチャー |
purchaseToken | string | トランザクションの一意のトークン。詳細はGoogleのドキュメントを参照してください |
var subscription = new AdjustPlayStoreSubscription(
購入データを記録する
ユーザーがサブスクリプションを購入した日を記録することができます。SDKはこのデータを返して、レポートします。
setTransactionDate(transactionDate: string): void
サブスクリプションオブジェクトでsetTransactionDate
メソッドを呼び出し、サブスクリプションのタイムスタンプを記録します。
var subscription = new AdjustAppStoreSubscription(
subscription.setTransactionDate(transactionDate);
Adjust.trackAppStoreSubscription(subscription);
setPurchaseTime(purchaseTime: string): void
サブスクリプションオブジェクトでsetPurchaseTime
メソッドを呼び出し、サブスクリプションのタイムスタンプを記録します。
var subscription = new AdjustPlayStoreSubscription(
subscription.setPurchaseTime(purchaseTime);
購入地域を記録する(iOSのみ)
setSalesRegion(salesRegion: string): void
ユーザーがサブスクリプションを購入した地域を記録することができます。これを行うには、subscriptionオブジェクトのsetSalesRegion
メソッドを呼び、国コードをstring
としてパスします。これは、Storefront
オブジェクトのcountryCode
としてフォーマットされる必要があります。
var subscription = new AdjustAppStoreSubscription(
subscription.setSalesRegion(salesRegion);
Adjust.trackPlayStoreSubscription(subscription);
コールバックパラメーターを追加する
コールバックパラメーターをサブスクリプションオブジェクトに追加することができます。Adjustは、これらのパラメーターをコールバックURLに追加します。コールバックパラメーターを追加するには、サブスクリプションオブジェクトのaddCallbackParameter
メソッドを呼び出してください。このメソッドを複数回呼び出すことで、複数のコールバックパラメーターを追加できます。
addCallbackParameter(key: string, value: string): void
var subscription = new AdjustAppStoreSubscription(
subscription.setTransactionDate(transactionDate);
subscription.setSalesRegion(salesRegion);
subscription.addCallbackParameter("key1", "value1");
subscription.addCallbackParameter("key2", "value2");
Adjust.trackAppStoreSubscription(subscription);
addCallbackParameter(key: string, value: string): void
var subscription = new AdjustPlayStoreSubscription(
subscription.addCallbackParameter("key1", "value1");
subscription.addCallbackParameter("key2", "value2");
パートナーパラメーターを追加する
パートナーパラメーターをサブスクリプションオブジェクトに追加することができます。SDKは、ユーザーがサブスクリプションを購入した時に、Adjustサーバーへこれらを送信します。Adjustサーバーは、その情報をネットワークパートナーに転送します。パラメーターパラメーターを追加するには、サブスクリプションオブジェクトのaddPartnerParameter
メソッドを呼び出してください。このメソッドを複数回呼び出すことで、複数のコールバックパラメーターを追加できます。
addPartnerParameter(key: string, value: string): void
var subscription = new AdjustAppStoreSubscription(
subscription.setTransactionDate(transactionDate);
subscription.setSalesRegion(salesRegion);
subscription.addPartnerParameter("key1", "value1");
subscription.addPartnerParameter("key2", "value2");
Adjust.trackAppStoreSubscription(subscription);
addPartnerParameter(key: string, value: string): void
var subscription = new AdjustPlayStoreSubscription(
subscription.addPartnerParameter("key1", "value1");
subscription.addPartnerParameter("key2", "value2");
サブスクリプションオブジェクトを設定したら、Adjust SDKを使用して記録することが可能です。
trackAppStoreSubscription(adjustAppStoreSubscription: AdjustAppStoreSubscription): void
完了したオブジェクトを trackAppStoreSubscription
メソッドにパスして、ユーザーのサブスクリプション購入を記録します。
var subscription = new AdjustAppStoreSubscription(
subscription.setTransactionDate(transactionDate);
subscription.setSalesRegion(salesRegion);
Adjust.trackAppStoreSubscription(subscription);
trackPlayStoreSubscription(adjustPlayStoreSubscription: AdjustPlayStoreSubscription): void
完了したオブジェクトを trackPlayStoreSubscription
メソッドにパスして、ユーザーのサブスクリプション購入を記録します。
var subscription = new AdjustPlayStoreSubscription(
subscription.setPurchaseTime(purchaseTime);
Adjust.trackPlayStoreSubscription(subscription);