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