Unity SDK - アプリ内イベントのトラッキング

ドキュメント

アプリ内イベントのトラッキング

アプリ内イベントをトラッキングして、キャンペーンのパフォーマンスを分析し、ユーザーのログイン、登録、チュートリアルの完了、進行のマイルストーンなどの主要業績評価指標(KPI)を測定します。

標準イベントと属性

標準イベントの使用

Singularは、レポートや最適化のために広告ネットワークが認識する標準イベントをサポートしています。自動認識とセットアップの簡素化のために、可能な限り標準イベント名を使用してください。

UA、マーケティング、またはビジネスチームは、組織のマーケティングKPIに基づいてイベントのリストを編集する必要があります。 アプリ内イベントをトラッキングする方法」を参照してください:ガイド(How to Track In-App Events:Guide For Singular Attribution Customers)を参照してください。

各イベントはさまざまな属性をサポートします。実装の詳細については、イベントごとの推奨標準属性を参照してください。


イベントの送信

イベント実装ガイドライン

エンリッチデータ用のオプション属性を持つEvent() メソッドを使用してSingularにイベントを送信します。

  • 標準イベント:標準イベントリストからイベントのUnity名を使用します(例:Events.sngLogin)。
  • カスタムイベント:標準イベントにマッチしないアプリ独自のイベントには、文字制限に準拠した任意の説明文字列を使用してください。

カスタムイベントの制限

  • 言語:サードパーティのパートナーや分析ソリューションとの互換性を確保するために、イベント名と属性を英語で渡します。
  • イベント名:非ASCII文字列は、UTF-8に変換したときに32バイト未満でなければなりません。
  • 属性と値:500ASCII文字に制限

イベント・メソッド

変数引数または辞書形式を使用して、追加情報の有無にかかわらずユーザーイベントを報告する。

メソッド・シグネチャ

public static void Event(string name)
public static void Event(string name, params object[] args)
public static void Event(Dictionary<string, object> args, string name)

注: params object[] argsシグネチャを使用する場合、args リストには偶数個のエレメント(キーと値のペア)を含める必要があります。ディクショナリを渡す場合、値は次のいずれかの型でなければなりません:文字列、int、long、float、double、null、ArrayList、Dictionary<文字列、オブジェクト>。

使用例

C#
// Example 1: Standard event without attributes
SingularSDK.Event(Events.sngLogin);

// Example 2: Standard event with recommended attributes (key-value pairs)
SingularSDK.Event(Events.sngTutorialComplete,
    Attributes.sngAttrContent, "Unity Basics",
    Attributes.sngAttrContentId, 32,
    Attributes.sngAttrContentType, "video",
    Attributes.sngAttrSuccess, "yes"
);

// Example 3: Standard event with attributes using Dictionary
Dictionary<string, object> attributes = new Dictionary<string, object>()
{
    [Attributes.sngAttrContent] = "Unity Basics",
    [Attributes.sngAttrContentId] = 32,
    [Attributes.sngAttrContentType] = "video",
    [Attributes.sngAttrSuccess] = "yes"
};
SingularSDK.Event(attributes, Events.sngTutorialComplete);

// Example 4: Custom event without attributes
SingularSDK.Event("SignUp");

// Example 5: Custom event with custom attributes
SingularSDK.Event("Bonus Points Earned", "Points", 500, "Level", 5);

アプリ内収益のトラッキング

アプリ内課金(IAP)、サブスクリプション、およびカスタム収益ソースからの収益を追跡して、キャンペーンのパフォーマンスと広告費用対効果(ROAS)を測定します。

収益データは3つのチャネルを通じて流れます:

  • インタラクティブレポート:Singularダッシュボードで収益指標を表示
  • ログのエクスポート:カスタム分析のための詳細なETLデータへのアクセス
  • リアルタイムポストバック:収益イベントを外部プラットフォームへ送信

収益イベントの制限

  • イベント名:カスタム収益イベント名は32 ASCII文字(またはUTF-8に変換された非ASCIIの場合は32バイト)に制限されます。
  • 属性:イベント属性名と値は500 ASCII文字に制限されます。
  • 通貨コード:すべて大文字で、3文字のISO 4217標準(例:USD、EUR、INR)に従わなければならない。

注:異なる通貨での収益は、Singularアカウントで設定された組織の優先通貨に自動的に変換されます。

ベストプラクティス

  • 標準的なネーミング:Singularの標準的なイベントと属性の命名規則を使用してください。
  • 言語:広告ネットワークのポストバックとの互換性を高めるため、カスタム収益イベント名を英語で送信する。
  • ゼロ以外の金額:金額が0以上の場合のみ収益イベントを送信します。

Unity IAPインテグレーション

Unity IAPでのアプリ内課金

UnityのIAP PurchaseまたはOrderオブジェクトをInAppPurchase() メソッドに渡し、充実したレポートとトランザクションの検証を行います。

メリット

  • 豊富なデータ:包括的なレポートのためにトランザクションの詳細をすべて受け取ります。
  • 不正防止:トランザクションレシートによる検証で、アプリ内の不正行為に対処できます。

Unity IAPバージョンの互換性

  • Unity IAP v5:Google Play Billing Library 7+と新しいUnity Purchasing APIを使用しています。Unity 2021.3 LTS以降と互換性があります。InAppPurchase(Order) メソッドを使用します。
  • Unity IAP v4:Google Play Billing Library 6と古いUnity IAP APIを使用します。Unity 2018.4 LTSから2020.3 LTSと互換性があります。InAppPurchase(Product)メソッドを使用します。

InAppPurchaseメソッド(Unity IAP v5)

Unity IAP v5のOrderオブジェクトを使用してIAPイベントを送信し、自動検証と充実したデータを提供します。

メソッドの署名

public static void InAppPurchase(Order order)
public static void InAppPurchase(Order order, Dictionary<string, object> attributes)
public static void InAppPurchase(Order order, bool isRestored)
public static void InAppPurchase(Order order, string eventName, Dictionary<string, object> attributes)

使用例

C#
// Example 1: IAP with order object only
SingularSDK.InAppPurchase(order);

// Example 2: IAP with order and additional attributes
Dictionary<string, object> attr = new Dictionary<string, object>()
{
    ["promo_code"] = "SUMMER2025",
    ["user_tier"] = "premium"
};
SingularSDK.InAppPurchase(order, attr);

// Example 3: IAP with restored transaction flag
SingularSDK.InAppPurchase(order, true);

// Example 4: IAP with custom event name and attributes
Dictionary<string, object> attr = new Dictionary<string, object>()
{
    ["subscription_tier"] = "gold",
    ["billing_period"] = "monthly"
};
SingularSDK.InAppPurchase(order, "PremiumSubscription", attr);

InAppPurchaseメソッド(Unity IAP v4)

Unity IAP v4のProductオブジェクトを使用してIAPイベントを送信し、自動検証とエンリッチデータを行います。

メソッドのシグネチャ

public static void InAppPurchase(Product product, Dictionary<string, object> attributes, bool isRestored = false)
public static void InAppPurchase(string eventName, Product product, Dictionary<string, object> attributes, bool isRestored = false)
public static void InAppPurchase(IEnumerable<Product> products, Dictionary<string, object> attributes, bool isRestored = false)
public static void InAppPurchase(string eventName, IEnumerable<Product> products, Dictionary<string, object> attributes, bool isRestored = false)

使用例

C#
// Example 1: IAP with single product, no extra attributes
SingularSDK.InAppPurchase(myProduct, null);

// Example 2: IAP with single product and attributes
Dictionary<string, object> attr = new Dictionary<string, object>()
{
    ["promo_code"] = "SUMMER2025",
    ["user_tier"] = "premium"
};
SingularSDK.InAppPurchase(myProduct, attr);

// Example 3: IAP with custom event name
SingularSDK.InAppPurchase("PremiumUpgrade", myProduct, null);

// Example 4: IAP with list of products
SingularSDK.InAppPurchase(myProductList, null);

// Example 5: IAP with list of products and custom event name
SingularSDK.InAppPurchase("BundlePurchase", myProductList, null);

購入検証なしのカスタム収益

手動収益トラッキング

PurchaseまたはOrderオブジェクトなしで、通貨、金額、およびオプションの製品詳細を渡すことによって収益を追跡します。このメソッドは、検証用のトランザクション領収書を提供しないことに注意してください。

重要:これらのメソッドを使用する場合、Singularはトランザクションを検証できません。可能な限り、上記のUnity IAPメソッドを使用することを強くお勧めします。


収益メソッド

通貨、金額、オプションの商品詳細を含む収益イベントを送信します。

メソッドの署名

public static void Revenue(string currency, double amount)
public static void Revenue(string currency, double amount, string productSKU, string productName, string productCategory, int productQuantity, double productPrice)
public static void Revenue(string currency, double amount, Dictionary<string, object> attributes)

使用例

C#
// Example 1: Revenue without product details
SingularSDK.Revenue("USD", 1.99);

// Example 2: Revenue with product details
SingularSDK.Revenue("USD", 4.99, "coin_package_abc123", "Coin Pack 5", "Bundles", 1, 4.99);

// Example 3: Revenue with attributes dictionary
Dictionary<string, object> attributes = new Dictionary<string, object>()
{
    ["productSKU"] = "coin_package_abc123",
    ["productName"] = "Coin Pack 5",
    ["productCategory"] = "Bundles",
    ["productQuantity"] = 2,
    ["productPrice"] = 4.99,
    ["transaction_id"] = "T12345"
};
SingularSDK.Revenue("USD", 9.98, attributes);

CustomRevenue メソッド

指定したイベント名、通貨、金額、およびオプションのトランザクション属性を含むカスタム収益イベントを送信します。

メソッドのシグネチャ

public static void CustomRevenue(string eventName, string currency, double amount)
public static void CustomRevenue(string eventName, string currency, double amount, string productSKU, string productName, string productCategory, int productQuantity, double productPrice)
public static void CustomRevenue(string eventName, string currency, double amount, Dictionary<string, object> attributes)

使用例

C#
// Example 1: Custom revenue without product details
SingularSDK.CustomRevenue("MyCustomRevenue", "USD", 9.99);

// Example 2: Custom revenue with product details
SingularSDK.CustomRevenue("MyCustomRevenue", "USD", 50.50, "abc123", "Premium Item", "Virtual Goods", 2, 25.50);

// Example 3: Custom revenue with attributes dictionary
Dictionary<string, object> attributes = new Dictionary<string, object>()
{
    ["productSKU"] = "premium_bundle_xyz",
    ["productName"] = "Premium Bundle",
    ["productCategory"] = "Bundles",
    ["productQuantity"] = 1,
    ["productPrice"] = 99.99,
    ["discount_applied"] = true
};
SingularSDK.CustomRevenue("PremiumBundlePurchase", "USD", 99.99, attributes);

ハイブリッドイベント追跡(上級者向け)

最適なアトリビューションのために、アプリに統合されたSingular SDKを通してすべてのイベントと収益を送信します。ただし、Singularは必要に応じて他のソースからイベントを収集することができます。

Singular SDK以外で送信されたイベントは、SingularのServer-to-Server Event documentationに準拠し、正しいアトリビューションのために一致するデバイス識別子を提供する必要があります。

重要です:

サーバー間リクエストのデバイス識別子がSingular SDKによって記録された識別子に一致しない場合、不一致が発生します:

  • 初期イベント:Singular SDK がデバイス識別子を記録する前にイベントが到着した場合、そのイベントは未知のデバイスの「最初のセッション」となり、その結果アトリビューションが不正になります。
  • 識別子の不一致:Singular SDKがサーバー間リクエストのデバイス識別子と異なるデバイス識別子を記録した場合、イベントは正しく帰属されません。

ハイブリッドイベントトラッキングガイド

内部サーバーからのイベント送信

内部サーバーから収益データを収集し、キャンペーンのパフォーマンスとROIを分析します。

要件

  • デバイス識別子を取得する:アプリ内登録またはログインイベント中に、デバイス識別子を取得して渡し、このデータをユーザーIDとともにサーバーに保存します。ユーザーが新しいアプリセッションを生成したときに識別子を更新し、正しいアトリビューションを確保します。
  • プラットフォーム固有の識別子:プラットフォーム(iOSデバイスのIDFAまたはIDFV、AndroidデバイスのGAIDなど)に一致するデバイス識別子でサーバーサイドのイベントを送信します。
  • リアルタイム更新:Singular Internal BIのポストバックメカニズムを使用して、エンドポイントにリアルタイムでイベントをプッシュします。内部BIポストバックのFAQを参照してください。
  • 実装の詳細:サーバー間統合ガイドの「収益の追跡」セクションを参照してください。

収益プロバイダからのイベントの送信

RevenueCatやadaptyのようなサードパーティの収益プロバイダーを統合して、購入や購読の収益をSingularに送信します。

サポートしているプロバイダー


セグメントからのイベント送信

Segmentに "Cloud-Mode "送信先を追加することで、Singular SDKと並行してSegmentからSingularへイベントを送信できるようになります。

詳細な設定方法については、実装ガイドSingular-Segment Integrationに従ってください。