adjust-icon

サブスクリプション情報の送信

App StoreおよびPlay Storeのサブスクリプションを計測し、それぞれの有効性をAdjust SDKで確認できます。ユーザーがサブスクリプションの購入を完了したら、その詳細を含むAdjustAppStoreSubscriptionまたはAdjustPlayStoreSubscriptionを作成してください。

1. Instantiate a subscription object

開始するには、サブスクリプション購入の詳細を含むサブスクリプションオブジェクトを作成する必要があります。

メソッドシグネチャー
public AdjustAppStoreSubscription(string price, string currency, string transactionId, string receipt)

以下のプロパティを含むAdjustAppStoreSubscriptionオブジェクトを作成します:

パラメーターデータタイプ説明
pricestringサブスクリプションの価格
currencystringサブスクリプションの通貨。priceLocaleオブジェクトのcurrencyCodeとしてフォーマットされる
transactionIdstringトランザクションID
receiptstringレシート情報
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
price,
currency,
transactionId,
receipt);

Record the purchase date

ユーザーがサブスクリプションを購入した日を記録することができます。SDKはこのデータを返して、レポートします。

メソッドシグネチャー
public void setTransactionDate(string transactionDate);

サブスクリプションオブジェクトでsetTransactionDateメソッドを呼び出し、サブスクリプションのタイムスタンプを記録します。

AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
price,
currency,
transactionId,
receipt);
//...
subscription.setTransactionDate(transactionDate);

Record the purchase region (iOS only)

メソッドシグネチャー
public void setSalesRegion(string salesRegion);

ユーザーがサブスクリプションを購入した地域を記録することができます。これを行うには、subscriptionオブジェクトのsetSalesRegionメソッドを呼び、国コードをstringとしてパスします。これは、priceLocaleオブジェクトのcountryCodeとしてフォーマットされる必要があります。

AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
price,
currency,
transactionId,
receipt);
//...
subscription.setSalesRegion(salesRegion);

Add callback parameters

コールバックパラメーターをサブスクリプションオブジェクトに追加することができます。Adjustは、これらのパラメーターをコールバックURLに追加します。コールバックパラメーターを追加するには、サブスクリプションオブジェクトのaddCallbackParameterメソッドを呼び出してください。このメソッドを複数回呼び出すことで、複数のコールバックパラメーターを追加できます。

メソッドシグネチャー
public void addCallbackParameter(string key, string value);
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
price,
currency,
transactionId,
receipt);
//...
subscription.addCallbackParameter("key1", "value1");
subscription.addCallbackParameter("key2", "value2");

Add partner parameters

パートナーパラメーターをサブスクリプションオブジェクトに追加することができます。SDKは、ユーザーがサブスクリプションを購入した時に、Adjustサーバーへこれらを送信します。Adjustサーバーは、その情報をネットワークパートナーに転送します。パラメーターパラメーターを追加するには、サブスクリプションオブジェクトのaddPartnerParameterメソッドを呼び出してください。このメソッドを複数回呼び出すことで、複数のコールバックパラメーターを追加できます。

メソッドシグネチャー
public void addPartnerParameter(string key, string value);
AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
price,
currency,
transactionId,
receipt);
//...
subscription.addPartnerParameter("key1", "value1");
subscription.addPartnerParameter("key2", "value2");

2. Record subscription information

サブスクリプションオブジェクトを設定したら、Adjust SDKを使用して記録することが可能です。

メソッドシグネチャー
public static void trackAppStoreSubscription(AdjustAppStoreSubscription subscription);

完了したオブジェクトを trackAppStoreSubscriptionメソッドにパスして、ユーザーのサブスクリプション購入を記録します。

AdjustAppStoreSubscription subscription = new AdjustAppStoreSubscription(
price,
currency,
transactionId,
receipt);
subscription.setTransactionDate(transactionDate);
subscription.setSalesRegion(salesRegion);
subscription.addCallbackParameter("key1", "value1");
subscription.addCallbackParameter("key2", "value2");
subscription.addPartnerParameter("key1", "value1");
subscription.addPartnerParameter("key2", "value2");
Adjust.trackAppStoreSubscription(subscription);