アプリ内イベントのトラッキング
アプリ内イベントをトラッキングして、キャンペーンのパフォーマンスを分析し、ユーザーのログイン、登録、チュートリアル完了、進行状況のマイルストーンなどの主要業績評価指標(KPI)を測定します。
標準イベントと属性
標準イベントの使用
Singularは、広告ネットワークがレポートおよび最適化のために認識する 標準イベント をサポートしています。自動認識とセットアップの簡素化のため、可能な限り標準イベント名を使用してください。
UA、マーケティング、またはビジネスチームは、組織のマーケティングKPIに基づいてイベントのリストを作成する必要があります。計画については、ガイド アプリ内イベントのトラッキング方法:Singularアトリビューション顧客向けガイド を参照してください。
各イベントはさまざまな属性をサポートしています。実装の詳細については、 イベントごとの推奨標準属性 を参照してください。
イベントの送信
イベント実装ガイドライン
ユーザーのアクションや行動をトラッキングするため、
event
または
eventWithArgs
メソッドを使用してイベントをSingularに送信します。
-
標準イベント:
標準イベントリストにある
イベントのiOS名
を使用します。例:
EVENT_SNG_LOGIN - カスタムイベント: 標準イベントに一致しない、アプリ固有のイベントの場合は、文字数制限に準拠した任意の説明的な文字列を使用します
カスタムイベントの制限:
- 言語: サードパーティパートナーおよび分析ソリューションとの互換性を確保するため、イベント名と属性は英語で渡してください
- イベント名: 32 ASCII文字に制限されています。非ASCII文字列は、UTF-8に変換した際に32バイト未満である必要があります
- 属性と値: 500 ASCII文字に制限されています
event メソッド
シンプルなトラッキングシナリオのために、追加情報なしでユーザーイベントをレポートします。
メソッドシグネチャ:
+ (void)event:(NSString *)name;
+event:
は
void
を返すため、呼び出し元では成功/失敗のシグナルはありません。名前が
nil
または空の場合、あるいは
+start:
がまだ呼び出されていない場合、SDKはイベントを暗黙的にドロップします。問題についてはログを確認してください。
使用例
// Example 1: Standard event
Singular.event(EVENT_SNG_LOGIN)
// Example 2: Custom event
Singular.event("signup")
// Example 1: Standard event
[Singular event:EVENT_SNG_LOGIN];
// Example 2: Custom event
[Singular event:@"signup"];
eventWithArgs メソッド
構造化データのために辞書形式を使用して、追加情報付きでユーザーイベントをレポートします。
メソッドシグネチャ:
+ (void)event:(NSString *)name withArgs:(NSDictionary *)args;
注:
args
パラメータは、1つ以上のキーと値のペアを含むNSDictionaryです。キーは文字列である必要があり、値はNSDictionaryで許可される任意の型を指定できます。
使用例
// Example 1: Standard event with recommended attributes
var dic: [AnyHashable: Any] = [:]
dic[ATTRIBUTE_SNG_ATTR_CONTENT_TYPE] = "video"
dic[ATTRIBUTE_SNG_ATTR_CONTENT_ID] = "32"
dic[ATTRIBUTE_SNG_ATTR_CONTENT] = "Telugu"
dic[ATTRIBUTE_SNG_ATTR_SUCCESS] = "yes"
Singular.event(EVENT_SNG_TUTORIAL_COMPLETE, withArgs: dic)
// Example 2: Custom event with custom attributes
var bonusData: [AnyHashable: Any] = [
"level": 10,
"points": 500
]
Singular.event("Bonus Points Earned", withArgs: bonusData)
// Example 1: Standard event with recommended attributes
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
[dic setValue:@"video" forKey:ATTRIBUTE_SNG_ATTR_CONTENT_TYPE];
[dic setValue:@"32" forKey:ATTRIBUTE_SNG_ATTR_CONTENT_ID];
[dic setValue:@"Telugu" forKey:ATTRIBUTE_SNG_ATTR_CONTENT];
[dic setValue:@"yes" forKey:ATTRIBUTE_SNG_ATTR_SUCCESS];
[Singular event:EVENT_SNG_TUTORIAL_COMPLETE withArgs:dic];
// Example 2: Custom event with custom attributes
NSMutableDictionary *bonusData = [[NSMutableDictionary alloc] init];
[bonusData setValue:@10 forKey:@"level"];
[bonusData setValue:@500 forKey:@"points"];
[Singular event:@"Bonus Points Earned" withArgs:bonusData];
アプリ内収益のトラッキング
アプリ内購入(IAP)、サブスクリプション、カスタム収益ソースからの収益をトラッキングして、キャンペーンのパフォーマンスと広告費用対効果(ROAS)を測定します。
収益データは3つのチャネルを通じて流れます:
- インタラクティブレポート: Singularダッシュボードで収益指標を確認します
- エクスポートログ: カスタム分析のために詳細なETLデータにアクセスします
- リアルタイムポストバック: 収益イベントを外部プラットフォームに送信します
収益イベントの制限:
- イベント名: カスタム収益イベント名は32 ASCII文字(非ASCIIの場合はUTF-8に変換した際に32バイト)に制限されています
- 属性: イベント属性名と値は500 ASCII文字に制限されています
- 通貨コード: すべて大文字で、3文字の ISO 4217標準 に従う必要があります(例:USD、EUR、INR)
ベストプラクティス
- 標準命名: Singularの 標準イベントおよび属性の命名規則 を使用してください
- 言語: 広告ネットワークのポストバック互換性を向上させるため、カスタム収益イベント名は英語で送信してください
- ゼロ以外の金額: 金額が0より大きいか小さい場合にのみ、収益イベントを送信してください
サブスクリプション以外のアプリ内購入
SKPaymentTransaction の統合
StoreKitの
SKPaymentTransaction
オブジェクトを
iapComplete
メソッドに渡すことで、レポートの充実化とトランザクションの検証が可能になります。
メリット:
- 豊富なデータ: Singularは包括的なレポートのために完全なトランザクションの詳細を受け取ります
- 不正防止: トランザクションのレシートにより、アプリ内不正に対抗するための検証が可能になります
注意事項:
-
必須オブジェクト:
iapCompleteメソッドには SKPaymentTransaction オブジェクトが必要です - 通貨換算: 異なる通貨での収益は、組織の優先通貨に自動的に換算されます
-
カスタムイベント名:
レポートでイベントタイプごとに収益を分類するには、
withNameパラメータを使用します
iapComplete メソッド
自動検証と充実したデータのために、SKPaymentTransactionオブジェクトを含む収益イベントを送信します。
メソッドシグネチャ:
+ (void)iapComplete:(id)transaction;
+ (void)iapComplete:(id)transaction withName:(NSString *)name;
使用例
// Get the SKPaymentTransaction object
let transaction: SKPaymentTransaction = ...
// Send transaction without custom event name
Singular.iapComplete(transaction)
// Send transaction with custom event name
Singular.iapComplete(transaction, withName: "MyCustomRevenue")
// Get the SKPaymentTransaction object
SKPaymentTransaction *transaction = ...;
// Send transaction without custom event name
[Singular iapComplete:transaction];
// Send transaction with custom event name
[Singular iapComplete:transaction withName:@"MyCustomRevenue"];
サブスクリプション収益
サブスクリプションイベントの実装
サブスクリプションの購入と更新をトラッキングして、ユーザーの行動と継続的な収益創出に関するインサイトを得ます。
実装ガイド: Singular SDKでサブスクリプションをトラッキングするための詳細な手順については、包括的な サブスクリプションイベント技術実装ガイド を確認してください。
購入検証なしのカスタム収益
手動での収益トラッキング
SKPaymentTransactionオブジェクトなしで、通貨、金額、およびオプションの商品詳細を渡すことで収益をトラッキングします。このメソッドでは、検証用のトランザクションレシートが提供されないことに注意してください。
重要: これらのメソッドを使用する場合、Singularはトランザクションを検証できません。可能な限り、上記で説明したSKPaymentTransactionメソッドの使用を強く推奨します。
revenue メソッド
通貨、金額、およびオプションの商品詳細を含む収益イベントを送信します。
メソッドシグネチャ:
+ (void)revenue:(NSString *)currency amount:(double)amount;
+ (void)revenue:(NSString *)currency
amount:(double)amount
productSKU:(NSString *)productSKU
productName:(NSString *)productName
productCategory:(NSString *)productCategory
productQuantity:(int)productQuantity
productPrice:(double)productPrice;
+ (void)revenue:(NSString *)currency
amount:(double)amount
withAttributes:(NSDictionary *)attributes;
使用例
// Without product details
Singular.revenue("USD", amount: 1.99)
// With product details
Singular.revenue("EUR",
amount: 5.00,
productSKU: "SKU1928375",
productName: "Reservation Fee",
productCategory: "Fee",
productQuantity: 1,
productPrice: 5.00)
// With product details in a dictionary
var dic: [AnyHashable: Any] = [:]
dic[ATTRIBUTE_SNG_ATTR_ITEM_DESCRIPTION] = "100% Organic Cotton Mixed Plaid Flannel Shirt"
dic[ATTRIBUTE_SNG_ATTR_ITEM_PRICE] = "$69.95"
dic[ATTRIBUTE_SNG_ATTR_RATING] = "5 Star"
dic[ATTRIBUTE_SNG_ATTR_SEARCH_STRING] = "Flannel Shirt"
Singular.revenue("USD", amount: 19.95, withAttributes: dic)
// Without product details
[Singular revenue:@"USD" amount:1.99];
// With product details
[Singular revenue:@"EUR"
amount:5.00
productSKU:@"SKU1928375"
productName:@"Reservation Fee"
productCategory:@"Fee"
productQuantity:1
productPrice:5.00];
// With product details in a dictionary
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
[dic setValue:@"100% Organic Cotton Mixed Plaid Flannel Shirt"
forKey:ATTRIBUTE_SNG_ATTR_ITEM_DESCRIPTION];
[dic setValue:@"$69.95" forKey:ATTRIBUTE_SNG_ATTR_ITEM_PRICE];
[dic setValue:@"5 Star" forKey:ATTRIBUTE_SNG_ATTR_RATING];
[dic setValue:@"Flannel Shirt" forKey:ATTRIBUTE_SNG_ATTR_SEARCH_STRING];
[Singular revenue:@"USD" amount:19.99 withAttributes:dic];
customRevenue メソッド
指定したイベント名、通貨、金額、およびオプションのトランザクション属性を含むカスタム収益イベントを送信します。
メソッドシグネチャ:
+ (void)customRevenue:(NSString *)eventName
currency:(NSString *)currency
amount:(double)amount;
+ (void)customRevenue:(NSString *)eventName
currency:(NSString *)currency
amount:(double)amount
productSKU:(NSString *)productSKU
productName:(NSString *)productName
productCategory:(NSString *)productCategory
productQuantity:(int)productQuantity
productPrice:(double)productPrice;
+ (void)customRevenue:(NSString *)eventName
currency:(NSString *)currency
amount:(double)amount
withAttributes:(NSDictionary *)attributes;
使用例
// Without product details
Singular.customRevenue("MyCustomRevenue", currency: "USD", amount: 1.99)
// With product details
Singular.customRevenue("MyCustomRevenue",
currency: "EUR",
amount: 5.00,
productSKU: "SKU1928375",
productName: "Reservation Fee",
productCategory: "Fee",
productQuantity: 1,
productPrice: 5.00)
// With product details in a dictionary
var dic: [AnyHashable: Any] = [:]
dic[ATTRIBUTE_SNG_ATTR_ITEM_DESCRIPTION] = "100% Organic Cotton Mixed Plaid Flannel Shirt"
dic[ATTRIBUTE_SNG_ATTR_ITEM_PRICE] = "$69.95"
dic[ATTRIBUTE_SNG_ATTR_RATING] = "5 Star"
dic[ATTRIBUTE_SNG_ATTR_SEARCH_STRING] = "Flannel Shirt"
Singular.customRevenue("CustomRevenueWithArgsDic",
currency: "USD",
amount: 44.99,
withAttributes: dic)
// Without product details
[Singular customRevenue:@"MyCustomRevenue" currency:@"USD" amount:1.99];
// With product details
[Singular customRevenue:@"MyCustomRevenue"
currency:@"EUR"
amount:5.00
productSKU:@"SKU1928375"
productName:@"Reservation Fee"
productCategory:@"Fee"
productQuantity:1
productPrice:5.00];
// With product details in a dictionary
NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
[dic setValue:@"100% Organic Cotton Mixed Plaid Flannel Shirt"
forKey:ATTRIBUTE_SNG_ATTR_ITEM_DESCRIPTION];
[dic setValue:@"$69.95" forKey:ATTRIBUTE_SNG_ATTR_ITEM_PRICE];
[dic setValue:@"5 Star" forKey:ATTRIBUTE_SNG_ATTR_RATING];
[dic setValue:@"Flannel Shirt" forKey:ATTRIBUTE_SNG_ATTR_SEARCH_STRING];
[Singular customRevenue:@"MyCustomRevenue"
currency:@"USD"
amount:44.99
withAttributes:dic];
StoreKit2 のサポート
StoreKit2 の収益トラッキング
StoreKit2フレームワークを使用するアプリでは、トランザクションと商品のJSON表現を用いて
customRevenue
メソッドを使用します。
StoreKit2の検証はSDKバージョン12.13以降でサポートされるようになりました。これらのメソッドでは、トランザクションおよび商品オブジェクトに jsonRepresentation 形式が必要です。
メソッドシグネチャ:
+ (void)customRevenue:(NSData *)transactionJsonRepresentation
productJsonRepresentation:(NSData *)productJsonRepresentation;
+ (void)customRevenue:(NSString *)eventName
transactionJsonRepresentation:(NSData *)transactionJsonRepresentation
productJsonRepresentation:(NSData *)productJsonRepresentation;
使用例
// Fetch transaction and product from StoreKit2
let transaction = ... // Valid StoreKit2 transaction
let product = ... // Valid StoreKit2 product
// Custom Revenue with default __iap__ event name
Singular.customRevenue(
transactionJsonRepresentation: transaction.jsonRepresentation,
productJsonRepresentation: product.jsonRepresentation)
// Custom Revenue with custom event name
Singular.customRevenue(
"PaymentSuccess",
transactionJsonRepresentation: transaction.jsonRepresentation,
productJsonRepresentation: product.jsonRepresentation)
// Fetch transaction and product from StoreKit2
SKTransaction *transaction = ...; // Valid StoreKit2 transaction
SKProduct *product = ...; // Valid StoreKit2 product
// Convert JSON representations to NSData
NSData *transactionData = [transaction.jsonRepresentation
dataUsingEncoding:NSUTF8StringEncoding];
NSData *productData = [product.jsonRepresentation
dataUsingEncoding:NSUTF8StringEncoding];
// Custom Revenue with default __iap__ event name
[Singular customRevenue:transactionData
productJsonRepresentation:productData];
// Custom Revenue with custom event name
[Singular customRevenue:@"PaymentSuccess"
transactionJsonRepresentation:transactionData
productJsonRepresentation:productData];
ハイブリッドイベントトラッキング(上級)
最適なアトリビューションのために、すべてのイベントと収益をアプリに統合されたSingular SDKを通じて送信してください。ただし、必要に応じてSingularは他のソースからイベントを収集できます。
Singular SDK以外で送信されるイベントは、Singularの サーバー間イベントのドキュメント に準拠し、正しいアトリビューションのために一致するデバイス識別子を提供する必要があります。
重要:
サーバー間リクエスト内のデバイス識別子が、Singular SDKによって記録された識別子と一致しない場合、不一致が発生します:
- 早すぎるイベント: Singular SDKがデバイス識別子を記録する前にイベントが到着すると、そのイベントは不明なデバイスの「初回セッション」となり、オーガニックアトリビューションになります
- 識別子の不一致: Singular SDKがサーバー間リクエスト内の識別子と異なるデバイス識別子を記録していた場合、イベントは誤ってアトリビュートされます
ハイブリッドイベントトラッキングガイド
内部サーバーからのイベント送信
内部サーバーから収益データを収集して、キャンペーンのパフォーマンスとROIを分析します。
要件:
- デバイス識別子の取得: アプリ内の登録またはログインイベント時に、デバイス識別子を取得して渡し、このデータをユーザーIDとともにサーバーに保存します。正しいアトリビューションを確保するため、ユーザーが新しいアプリセッションを生成した際には識別子を更新します
- プラットフォーム固有の識別子: プラットフォームに一致するデバイス識別子(例:iOSデバイスの場合はIDFAまたはIDFV)を含めてサーバーサイドイベントを送信します
- リアルタイム更新: Singular Internal BIポストバックメカニズムを使用して、イベントをリアルタイムでエンドポイントにプッシュします。 Internal BIポストバックFAQ を参照してください
- 実装の詳細: サーバー間統合ガイドの 「収益のトラッキング」 セクションを確認してください
収益プロバイダーからのイベント送信
RevenueCatやadaptyなどのサードパーティの収益プロバイダーを統合して、購入およびサブスクリプションの収益をSingularに送信します。
サポートされているプロバイダー:
- RevenueCat: 詳細は RevenueCatのドキュメント を参照してください
- adapty: 詳細は adaptyのドキュメント を参照してください
Segment からのイベント送信
Segmentで「Cloud-Mode」の宛先を追加することで、Singular SDKと並行してSegmentがSingularにイベントを送信できるようにします。
詳細なセットアップ手順については、実装ガイド Singular-Segment統合 に従ってください。