Airbridgeダッシュボード > Tracking Link > Deep Link に以下の2つの情報を入力する必要があります。
iOS URI スキーム
iOSアプリID
AirbridgeダッシュボードのiOS URI Schemeの領域に、使用するスキームに://を追加して入力してください。
例) example://
Attention
AirbridgeのURIスキームは小文字の数字および一部の記号(
-,+,.) のみサポートしています。
1. https://developer.apple.com/account/resources の Identifiers に移動してください。
2. トラッキングしたいアプリの Identifier をクリックしてください。
3. その Identifier の App ID Prefix + . + Bundle ID をAirbridgeダッシュボードの iOS App ID の領域に入力してください。
例) 9JA89QQLNQ.com.apple.wwdc
1. Xcode> Projectファイル> Info> URL Typesに移動してください。
2. URLスキームの領域に、Airbridgeダッシュボードに入力した iOS URIスキームを入力してください。
Attention
://は削除して入力してください。
Xcode > Project ファイル> Signing & Capabilitiesに移動してください。
+ Capabilityをクリックして Associated Domainsを追加してください。
Associated Domainsに applinks:YOUR_APP_NAME.airbridge.ioを追加してください。
Associated Domainsに applinks:YOUR_APP_NAME.deeplink.pageを追加してください。
YOUR_APP_NAMEはダッシュボードのSettings>Tokens>アプリ名で確認できます。
自動入力機能を使う場合、トラブルシューティング > ウェブクレデンシャルを参照してください。
iOS 12およびその前のバージョンをサポートするアプリの場合、一般的に AppDelegate の application(_:open:options:) メソッドでイベントを送信します。
1. ios/[プロジェクト名]/AppDelegate ファイルを開いてください。
2. 以下の関数の最上部で handleURLSchemeDeeplink 関数を呼び出し、アプリがこのスキームで開かれた時、SDKにディープリンクの情報を渡してください。
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id>*)options{ [AirBridge.deeplink handleURLSchemeDeeplink:url]; return YES;}func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool{ AirBridge.deeplink()?.handleURLSchemeDeeplink(url) return true}3. 以下の関数の最上部で handleUserActivity関数を呼び出し、アプリがこのユニバーサルリンクで開かれた時、SDKにディープリンクの情報を渡してください。
- (BOOL)application:(UIApplication*)applicationcontinueUserActivity:(NSUserActivity*)userActivity restorationHandler:(void (^)(NSArray* _Nullable))restorationHandler{ [AirBridge.deeplink handleUserActivity:userActivity]; return YES;}func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool{ AirBridge.deeplink()?.handle(userActivity) return true}Attention
SceneDelegateを使うプロジェクトの場合、AppDelegateではなくSceneDelegateでURLが渡されます。SceneDelegateでURLを受信する方法は、次のセクションのSceneDelegateを使う場合を参照してください。
iOS 13および13以降のバージョンをサポートするアプリの中で、SceneDelegateを使うと以下のメソッドでディープリンクが渡されます。
アプリがNot runningの状態でロードされた場合:
scene(_:willConnectTo:options:)
それ以外の場合(ex. background):
Universal link: scene(_:continue:)
Scheme link: scene(_:openURLContexts:)
import UIKitimport AirBridge @available(iOS 13, *)class SceneDelegate: UIWindowSceneDelegate { var window: UIWindow? // Receive links after the app's killed func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { if let schemeLinkURL = connectionOptions.urlContexts.first?.url { // Scheme AirBridge.deeplink()?.handleURLSchemeDeeplink(schemeLinkURL) } else if let userActivity = connectionOptions.userActivities.first { // Universal AirBridge.deeplink()?.handle(userActivity) } // ... } // Receive universal link func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { AirBridge.deeplink().handle(userActivity) // ... } // Receive scheme link func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { guard let schemeLinkURL = URLContexts.first?.url else { return } AirBridge.deeplink().handleURLSchemeDeeplink(schemeLinkURL) // ... }}SwiftUIを使っていてSceneDelegateを使わない場合は onOpenUrl でディープリンクが渡されます。SDK初期化と同様に、@main が存在するアプリのクラスに以下のメソッドを追加します。
import SwiftUIimport AirBridge @main@available(iOS 14, *)struct OnlyUIApp: App { ... var body: some Scene { WindowGroup { ContentView() .onOpenURL { url in if url.scheme != "http" && url.scheme != "https" { // Scheme Link AirBridge.deeplink()?.handleURLSchemeDeeplink(url) } else { // Universal Link let userActivity = NSUserActivity(activityType: NSUserActivityTypeBrowsingWeb) userActivity.webpageURL = url AirBridge.deeplink().handle(userActivity) } } } }}Attention
SwiftUIを使っていてSceneDelegateが存在するプロジェクトでは、onOpenUrlを使うことができません。この場合、上記のSceneDelegateを使う場合を参照してください。
1. ios/[プロジェクト名]/AppDelegateファイルを開いてください。
2. AppDelegateの application(_:didFinishLaunchingWithOptions:)でsetDeeplinkCallback 関数を使用し、ディープリンクでアプリが開かれた時に呼び出すコールバックを設定してください。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { [AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions]; [AirBridge.deeplink setDeeplinkCallback:^(NSString* deeplink) { // ディープリンクでアプリが開かれた場合に作動するコード // Airbridge を通じたディープリンク = YOUR_SCHEME://... NSLog(@"DeeplinkCallback : %@", deeplink); }];}func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey:Any]?) -> Bool { AirBridge.getInstance("YOUR_APP_TOKEN", appName: "YOUR_APP_NAME", withLaunchOptions: launchOptions) AirBridge.deeplink()?.setDeeplinkCallback({ (deeplink) in // ディープリンクでアプリが開かれた場合に作動するコード // Airbridge を通じたディープリンク = YOUR_SCHEME://... NSLog("DeeplinkCallback : %@", deeplink) }) return true}SDK初期化と同様に、@main が存在するアプリのクラスのコンストラクタに以下のメソッドを追加します。
import SwiftUIimport AirBridge @main@available(iOS 14, *)struct OnlyUIApp: App { init() { AirBridge.getInstance("YOUR_APP_SDK_TOKEN", appName: "YOUR_APP_NAME") AirBridge.deeplink()?.setDeeplinkCallback { deeplink in print(deeplink) } } var body: some Scene { WindowGroup { ContentView() } }}アプリを開く全てのディープリンクは ディープリンクコールバック に送られます。 そのディープリンクのうち、Airbridgeを通じたディープリンク はAirbridgeダッシュボードの iOS URI Scheme に入力した YOUR_SCHEME://... の形式で渡されます。
ディファードディープリンクはATTのステータスが選択された時やタイムアウトが発生した時、コールバックに送られます。
Airbridge iOS SDK, 1.10.0 ~ 1.10.9 を使う場合: Airbridgeディープリンク は
https://YOUR_APP_NAME.airbridge.io/...の形式で渡されます。
Airbridge iOS SDK, ~ 1.9.10 を使う場合: Airbridgeディープリンク は
https://YOUR_APP_NAME.airbridge.io/... または YOUR_SCHEME://...の形式で渡されます。
Airbridgeのトラッキングリンクにカスタムドメインを使いたい場合、example.com の部分に設定したカスタムドメインを追加し、以下のように設定してください。
Xcode> Projectファイル> Signing & Capabilities> Associated Domainsに移動してください。
+ボタンをクリックして applinks:example.comを追加してください。
info.plist を開いてください。
次の値を追加してください。
Airbridgeダッシュボードの iOS URI Scheme に入力した YOUR_SCHEME://... の形式のディープリンクをクリックした時、アプリが開かれてディープリンクイベントが送信されるか確認してください。
例) example://
ディープリンクをクリックしてください。
Airbridgeダッシュボード> Raw Data> App Real-time Logsでディープリンクイベントが存在するか確認してください。
SDKにユーザー識別子情報を送信し、収集される全てのイベントに識別子を入力することができます。
[AirBridge.state setUserID:@"personID"];[AirBridge.state setUserEmail:@"persondoe@airbridge.io"];[AirBridge.state setUserPhone:@"1(123)123-1234"] // 入力された dictionary に user alias が変更されます。[AirBridge.state setUserAlias:@{@"key": @"value"}];// 既存の user alias に以下のキーと値が追加されます。[AirBridge.state addUserAliasWithKey:@"key" value:@"value"];AirBridge.state()?.setUserID("personID")AirBridge.state()?.setUserEmail("persondoe@airbridge.io")AirBridge.state()?.setUserPhone("(123)123-1234") // 入力された dictionary に user alias が変更されます。AirBridge.state()?.setUserAlias(["key": "value"])// 既存の user alias に以下のキーと値が追加されます。AirBridge.state()?.addUserAlias(withKey: "key", value: "value")MTA(Multi-Touch Attribution)分析の正確性向上、内部データ分析、サードパーティ(3rd Party)ソリューションとの連携などの目的で、ユーザーの追加属性データを設定できます。
// 入力された dictionary に user attributes が変更されます。[AirBridge.state setUserAttributes:@{@"key": @"value"}];// 既存の user attributes に以下のキーと値が追加されます。[AirBridge.state addUserAttributesWithKey:@"key" value:@"value"]; ユーザー設定を完了したあと、SDKからイベントを送信し、そのイベントに設定したユーザー情報があるか確認してください。
ユーザー設定をしてください。
SDKからイベントを送信してください。
Airbridgeダッシュボード> Raw Data> App Real-time Logsで送信したイベントをクリックし、JSONの中のuserの部分に設定したユーザー情報があるか確認してください。
SDKにデバイス識別子情報を設定すると、設定後から収集される全てのイベントにデバイス識別情報を追加することができます。デバイス識別子を一度設定すれば、削除しない限り、アプリを終了しても設定は維持されます。
[AirBridge.state setDeviceAliasWithKey: "ADD_YOUR_KEY", value: "AND_YOUR_VALUE"];[AirBridge.state removeDeviceAliasWithKey: "DELETE_THIS_KEY"];[AirBridge.state clearDeviceAlias];AirBridge.state()?.setDeviceAlias(key: "ADD_YOUR_KEY", value: "AND_YOUR_VALUE")AirBridge.state()?.removeDeviceAlias(key: "DELETE_THIS_KEY")AirBridge.state().clearDeviceAlias()ユーザーの重要な行動が発生した時、アプリ内イベントを通じて流入経路別の成果を計測できます。
全てのイベントのパラメータは選択的に追加することができますが、イベントに関する情報は正確な統計の提供に役立つため、追加することを推奨します。
SDKからイベントを送信することができます。Send events with the SDK.
setCategory 関数はイベント送信のために必須で呼び出す必要があります。
Attention
setCategory関数はイベント送信のために必須で呼び出す必要があります。
#import <AirBridge/ABInAppEvent.h> ABInAppEvent* event = [[ABInAppEvent alloc] init]; [event setCategory:@"category"];[event setAction:@"action"];[event setLabel:@"label"];[event setValue:@(123)];[event setCustoms:@{@"key": @"value"}]; // Semantic Attributes Option 1ABSemanticAttributes* semanticAttributes = [[ABSemanticAttributes alloc] init];semanticAttributes.transactionID = @"transaction_123";[event setSemanticAttributes:semanticAttributes]; // Semantic Attributes Option 2// For more details, please check following page// https://developers.airbridge.io/docs/event-structure#semantic-attributes[event setSemantics:@{@"transactionID": @"transaction_123"}]; [event send];let event = ABInAppEvent() event?.setCategory("category")event?.setAction("action")event?.setLabel("label")event?.setValue(123)event?.setCustoms(["key": "value"]) // Semantic Attributes Option 1let semanticAttributes = ABSemanticAttributes()semanticAttributes?.transactionID = "transaction_123"event?.setSemanticAttributes(semanticAttributes) // Semantic Attributes Option 2// For more details, please check following page// https://developers.airbridge.io/docs/event-structure#semantic-attributesevent?.setSemantics(["transactionID": "transaction_123"]) event?.send()#import <AirBridge/ABUser.h>#import <AirBridge/ABInAppEvent.h>#import <AirBridge/ABCategory.h> ABUser* user = [[ABUser alloc] init];user.ID = @"testID";user.email = @"testID@ab180.co";user.phone = @"000-0000-0000";user.alias = @{ @"key": @"value",};user.attributes = @{ @"key": @"value",}; [AirBridge.state setUser:user]; ABInAppEvent* event = [[ABInAppEvent alloc] init];[event setCategory:ABCategory.signUp]; [event send];let user = ABUser()user.id = "testID"user.email = "testID@ab180.co"user.phone = "000-0000-0000"user.attributes = [ "key": "value" as NSObject,]user.alias = [ "key": "value",] AirBridge.state().setUser(user) let event = ABInAppEvent()event?.setCategory(ABCategory.signUp)event?.send()#import <AirBridge/ABUser.h>#import <AirBridge/ABInAppEvent.h>#import <AirBridge/ABCategory.h> ABUser* user = [[ABUser alloc] init];user.ID = @"testID";user.email = @"testID@ab180.co";user.phone = @"000-0000-0000";user.alias = @{ @"key": @"value",};user.attributes = @{ @"key": @"value",}; [AirBridge.state setUser:user]; ABInAppEvent* event = [[ABInAppEvent alloc] init];[event setCategory:ABCategory.signIn]; [event send];let user = ABUser()user.id = "testID"user.email = "testID@ab180.co"user.phone = "000-0000-0000"user.attributes = [ "key": "value" as NSObject,]user.alias = [ "key": "value",] AirBridge.state().setUser(user) let event = ABInAppEvent()event?.setCategory(ABCategory.signIn)event?.send()#import <AirBridge/ABInAppEvent.h>#import <AirBridge/ABCategory.h> ABInAppEvent* event = [[ABInAppEvent alloc] init];[event setCategory:ABCategory.signOut]; [AirBridge.state setUser:[[ABUser alloc] init]];let event = ABInAppEvent()event?.setCategory(ABCategory.signOut)event?.send() AirBridge.state().setUser(ABUser())#import <AirBridge/ABInAppEvent.h>#import <AirBridge/ABCategory.h> ABInAppEvent* event = [[ABInAppEvent alloc] init];[event setCategory:ABCategory.viewHome]; [event send];let event = ABInAppEvent()event?.setCategory(ABCategory.viewHome)event?.send()#import <AirBridge/ABProduct.h>#import <AirBridge/ABInAppEvent.h>#import <AirBridge/ABCategory.h>#import <AirBridge/ABSemanticsKey.h> ABProduct* product1 = [[ABProduct alloc] init];product1.idx = @"idx1";product1.name = @"name1";product1.price = @100;product1.currency = @"USD";product1.orderPosition = @1;product1.quantity = @1; ABInAppEvent* event = [[ABInAppEvent alloc] init];[event setCategory:ABCategory.viewProductDetail];[event setSemantics:@{ ABSemanticsKey.products: @[product1.toDictionary],}]; [event send];let product1 = ABProduct()product1.idx = "idx1"product1.name = "name1"product1.price = 100product1.currency = "USD"product1.orderPosition = 1product1.quantity = 1 let event = ABInAppEvent()event?.setCategory(ABCategory.viewProductDetail)event?.setSemantics([ ABSemanticsKey.products: [ product1.toDictionary(), ],])event?.send()#import <AirBridge/ABProduct.h>#import <AirBridge/ABInAppEvent.h>#import <AirBridge/ABCategory.h>#import <AirBridge/ABSemanticsKey.h> ABProduct* product1 = [[ABProduct alloc] init];product1.idx = @"idx1";product1.name = @"name1";product1.price = @100;product1.currency = @"USD";product1.orderPosition = @1;product1.quantity = @1; ABProduct* product2 = [[ABProduct alloc] init];product2.idx = @"idx2";product2.name = @"name2";product2.price = @200;product2.currency = @"USD";product2.orderPosition = @2;product2.quantity = @2; ABInAppEvent* event = [[ABInAppEvent alloc] init];[event setCategory:ABCategory.viewProductList];[event setSemantics:@{ ABSemanticsKey.products: @[ product1.toDictionary, product2.toDictionary, ], ABSemanticsKey.productListID: @"listID",}]; [event send];let product1 = ABProduct()product1.idx = "idx1"product1.name = "name1"product1.price = 100product1.currency = "USD"product1.orderPosition = 1product1.quantity = 1 let product2 = ABProduct()product2.idx = "idx2"product2.name = "name2"product2.price = 200product2.currency = "USD"product2.orderPosition = 2product2.quantity = 2 let event = ABInAppEvent()event?.setCategory(ABCategory.viewProductList)event?.setSemantics([ ABSemanticsKey.products: [ product1.toDictionary(), product2.toDictionary(), ], ABSemanticsKey.productListID: "productListID",])event?.send()#import <AirBridge/ABProduct.h>#import <AirBridge/ABInAppEvent.h>#import <AirBridge/ABCategory.h>#import <AirBridge/ABSemanticsKey.h> ABProduct* product1 = [[ABProduct alloc] init];product1.idx = @"idx1";product1.name = @"name1";product1.price = @100;product1.currency = @"USD";product1.orderPosition = @1;product1.quantity = @1; ABProduct* product2 = [[ABProduct alloc] init];product2.idx = @"idx2";product2.name = @"name2";product2.price = @200;product2.currency = @"USD";product2.orderPosition = @2;product2.quantity = @2; ABInAppEvent* event = [[ABInAppEvent alloc] init];[event setCategory:ABCategory.viewSearchResult];[event setSemantics:@{ ABSemanticsKey.products: @[ product1.toDictionary, product2.toDictionary, ], ABSemanticsKey.query: @"query",}]; [event send];let product1 = ABProduct()product1.idx = "idx1"product1.name = "name1"product1.price = 100product1.currency = "USD"product1.orderPosition = 1product1.quantity = 1 let product2 = ABProduct()product2.idx = "idx2"product2.name = "name2"product2.price = 200product2.currency = "USD"product2.orderPosition = 2product2.quantity = 2 let event = ABInAppEvent()event?.setCategory(ABCategory.viewSearchResult)event?.setSemantics([ ABSemanticsKey.products: [ product1.toDictionary(), product2.toDictionary(), ], ABSemanticsKey.query: "query",])event?.send()#import <AirBridge/ABProduct.h>#import <AirBridge/ABInAppEvent.h>#import <AirBridge/ABCategory.h>#import <AirBridge/ABSemanticsKey.h> ABProduct* product1 = [[ABProduct alloc] init];product1.idx = @"idx1";product1.name = @"name1";product1.price = @100;product1.currency = @"USD";product1.orderPosition = @1;product1.quantity = @1; ABProduct* product2 = [[ABProduct alloc] init];product2.idx = @"idx2";product2.name = @"name2";product2.price = @200;product2.currency = @"USD";product2.orderPosition = @2;product2.quantity = @2; ABInAppEvent* event = [[ABInAppEvent alloc] init];[event setCategory:ABCategory.addToCart];[event setSemantics:@{ ABSemanticsKey.products: @[ product1.toDictionary, product2.toDictionary, ], ABSemanticsKey.cartID: @"cartID", ABSemanticsKey.currency: @"currency"}]; [event setValue:@300]; [event send];let product1 = ABProduct()product1.idx = "idx1"product1.name = "name1"product1.price = 100product1.currency = "USD"product1.orderPosition = 1product1.quantity = 1; let product2 = ABProduct()product2.idx = "idx2"product2.name = "name2"product2.price = 200product2.currency = "USD"product2.orderPosition = 2product2.quantity = 2; let event = ABInAppEvent()event?.setCategory(ABCategory.addToCart)event?.setSemantics([ ABSemanticsKey.products: [ product1.toDictionary(), product2.toDictionary(), ], ABSemanticsKey.cartID: "cartID", ABSemanticsKey.currency: "KRW",]) event.setValue(300) event?.send()#import <AirBridge/ABProduct.h>#import <AirBridge/ABInAppEvent.h>#import <AirBridge/ABCategory.h>#import <AirBridge/ABSemanticsKey.h> ABProduct* product1 = [[ABProduct alloc] init];product1.idx = @"coke_zero";product1.name = @"Coke Zero";product1.price = @100;product1.currency = @"USD";product1.orderPosition = @1;product1.quantity = @1; ABProduct* product2 = [[ABProduct alloc] init];product2.idx = @"burger_cheese_double";product2.name = @"Double Cheeseburger";product2.price = @200;product2.currency = @"USD";product2.orderPosition = @2;product2.quantity = @2; ABInAppEvent* event = [[ABInAppEvent alloc] init];[event setCategory:ABCategory.purchase];[event setSemantics:@{ ABSemanticsKey.products: @[ product1.toDictionary, product2.toDictionary, ], ABSemanticsKey.transcationID: @"transcationID", ABSemanticsKey.currency: @"currency", ABSemanticsKey.inAppPurchased: @YES}]; [event setValue:@300]; [event send];let product1 = ABProduct()product1.idx = "coke_zero"product1.name = "Coke Zero"product1.price = 100product1.currency = "USD"product1.orderPosition = 1product1.quantity = 1 let product2 = ABProduct()product2.idx = "burger_cheese_double"product2.name = "Double Cheeseburger"product2.price = 200product2.currency = "USD"product2.orderPosition = 2product2.quantity = 2 let event = ABInAppEvent()event?.setCategory(ABCategory.purchase)event?.setSemantics([ ABSemanticsKey.products: [ product1.toDictionary(), product2.toDictionary(), ], ABSemanticsKey.transactionID: "transactionID", ABSemanticsKey.currency: "KRW", ABSemanticsKey.inAppPurchased: true]) event?.setValue(300) event?.send()SDKからイベントを送信し、Airbridgeダッシュボードのそのイベントが存在するか確認してください。
SDKからイベントを送信してください。
Airbridgeダッシュボード> Raw Data> App Real-time Logsで送信したイベントが存在するか確認してください。
ユーザー情報のうち、Eメール、電話番号は自動的にSHA256でハッシュ化して送信します。
SDKを初期化するコードの上部で setIsUserInfoHashed の関数を呼び出し、設定を変更することができます。
// ユーザー情報のハッシュ化を解除[AirBridge setIsUserInfoHashed:NO]; [AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];// ユーザー情報のハッシュ化を解除AirBridge.setIsUserInfoHashed(false) AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)SDKを初期化するコードの上部で setSessionTimeout の関数を呼び出し、セッションタイムアウトを設定できます。
セッションタイムアウトの単位はミリ秒で、0以上604800000(7日)以下の値に設定してください。
セッションタイムアウトのデフォルト値は 1000 * 60 * 5 (5分)です。
[AirBridge setSessionTimeout:1000 * 60 * 5]; [AirBridge getInstance:@"YOUR_APP_SDK_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];AirBridge.setSessionTimeout(1000 * 60 * 5) AirBridge.getInstance("YOUR_APP_SDK_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)この機能はGDPRやCCPAのように、お客様から個人情報保護に関する同意を得てデータを収集、送信するときに有効な機能です。
SDK初期化コードの前に autoStartTrackingEnabled を false に設定すれば、SDKは startTracking 関数が呼び出されるまでイベントを送信しません。
そのため、アプリが起動していない状態でライフサイクルイベント(ディープリンクオープンなど)が発生すれば、startTracking 関数の呼び出しよりもそのイベントが先に送られるため、イベントが欠落することがあります。
AirBridge.autoStartTrackingEnabled = NO; [AirBridge getInstance:@"YOUR_APP_SDK_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions]; [AirBridge startTracking];AirBridge.setAutoStartTrackingEnabled(false) AirBridge.getInstance("YOUR_APP_SDK_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions) AirBridge.startTracking()SDKはディープリンクからアプリが起動した際、毎回ディープリンクイベントを送信します。
SDKを初期化するコードの上部で setIsTrackAirbridgeDeeplinkOnly の関数を呼び出して true に設定すれば、Airbridgeのディープリンクからアプリが起動した場合のみディープリンクイベントを送信するようになります。
// Airbridgeのディープリンクからアプリが起動した場合のみディープリンクイベントを送信[AirBridge setIsTrackAirbridgeDeeplinkOnly:YES]; [AirBridge getInstance:@"YOUR_APP_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];// Airbridgeのディープリンクからアプリが起動した場合のみディープリンクイベントを送信AirBridge.setIsTrackAirbridgeDeeplinkOnly(true) AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)以下の設定をすることで、FacebookのディファードアプリリンクをSDKで収集できます。
https://developers.facebook.com/docs/ios/getting-started
のリンクから Facebook SDK をインストールしてください。
ios/[プロジェクト名]/AppDelegateファイルを開いてください。
SDK初期化コードの前に setIsFacebookDeferredAppLinkEnabled
関数を呼び出してください。
isFacebookDeferredAppLinkEnabledの値がYESで、Facebook SDKがインストールされていれば、SDKではFacebookディファードアプリリンクを収集します。
[AirBridge setIsFacebookDeferredAppLinkEnabled:YES]; [AirBridge getInstance:@"YOUR_APP_SDK_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];AirBridge.setIsFacebookDeferredAppLinkEnabled(true) AirBridge.getInstance("YOUR_APP_SDK_TOKEN", appName: "YOUR_APP_NAME", withLaunchOptions: launchOptions)アプリのアンインストールトラッキング設定に関する詳細はこちらのページを参照してください。
プッシュ通知がクリックされた時、handleNotificationDeeplink の関数を呼び出し、プッシュ通知ペイロードのディープリンクをSDKに送信してください。
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { if (UIApplication.sharedApplication.applicationState == UIApplicationStateInactive) { NSURL* url = // プッシュ通知ペイロードのディープリンク [AirBridge.deeplink handleURLSchemeDeeplink:url]; }} - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler API_AVAILABLE(ios(10.0)) { if (UIApplication.sharedApplication.applicationState == UIApplicationStateInactive && [response.actionIdentifier isEqual:UNNotificationDefaultActionIdentifier]) { NSURL* url = // プッシュ通知ペイロードのディープリンク [AirBridge.deeplink handleURLSchemeDeeplink:url]; }}func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { if UIApplication.shared.applicationState == .inactive { let url = // プッシュ通知ペイロードのディープリンク AirBridge.deeplink()?.handleURLSchemeDeeplink(url) }} @available(iOS 10.0, *)func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { if UIApplication.shared.applicationState == .inactive, response.actionIdentifier == UNNotificationDefaultActionIdentifier { let url = // プッシュ通知ペイロードのディープリンク AirBridge.deeplink()?.handleURLSchemeDeeplink(url) }}ATTフレームワークを使ってトラッキング許可を選択するポップアップを表示する場合、トラッキング許可を選択しても、選択する前にインストールイベントが送信されるため、インストールイベントからIDFAの収集ができません。
SDK初期化コードの前に trackingAuthorizeTimeout でタイムアウトを設定すれば、Airbridgeはそのタイムアウトの間、ユーザーがポップアップでトラッキング許可を選択するまで待機してからインストールイベントを送信することができます。
trackingAuthorizeTimeoutの単位はミリ秒です。
trackingAuthorizeTimeoutまでインストールイベントの送信が遅れることがあります。
trackingAuthorizeTimeoutはアプリの再起動時に初期化します。
ATTのステータスが選択された時やタムアウトが発生した時、ディファードディープリンクがコールバックに送られます。
アプリの再起動時に毎回タイムアウトを初期化しないためには、isRestartTrackingAuthorizeTimeout をfalseに設定してください。
AirBridge.setting.trackingAuthorizeTimeout = 30 * 1000;AirBridge.setting.isRestartTrackingAuthorizeTimeout = NO; [AirBridge getInstance:@"YOUR_APP_SDK_TOKEN" appName:@"YOUR_APP_NAME" withLaunchOptions:launchOptions];AirBridge.setting()?.trackingAuthorizeTimeout = 30 * 1000AirBridge.setting()?.isRestartTrackingAuthorizeTimeout = false AirBridge.getInstance("YOUR_APP_SDK_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)Attention
上記のコードの中の
trackingAuthorizeTimeoutの値はTracking Authorized Timeoutの時間を任意で設定した例となっています。実際に活用する際には、必ずアプリのUX(ユーザー体験)とATTプロンプトの設定に合わせて値を変更してください。
Airbridge SDKには、イベントを送信できない環境に備えてイベントをストレージに保存し、リトライする機能があります。この機能を活用し、Airbridgeがイベントの保存に使うストレージを制限することができます。
// Event count limit[AirBridge.setting setEventMaximumBufferCount:newValue]// Event size limit (Byte)[AirBridge.setting setEventMaximumBufferSize:newValue]// Event count limitAirBridge.setting().setEventMaximumBufferCount(newValue)// Event size limit (Byte)AirBridge.setting().setEventMaximumBufferSize(newValue)Airbridge SDKではイベントを送信する周期を設定できます。イベントを1回送信した後、設定した周期の間はイベントの送信が行われません。デフォルトのイベント送信周期は0ミリ秒です。
// イベントの数の制限[AirBridge.setting setEventMaximumBufferCount:newValue]// イベントのサイズの制限(バイト単位)[AirBridge.setting setEventMaximumBufferSize:newValue] Airbridgeの初期化の際に、内部ストレージに保存されている全てのイベントを削除する機能です。
Airbridgeはイベントを送信する時、欠損を最小化するために未送信イベントを内部ストレージに保存します。この機能を有効化すれば、Airbridgeの初期化の際にストレージのイベントを全て削除します。
// 활성화Airbridge.setResetEventBufferEnabled(true) // 비활성화Airbridge.setResetEventBufferEnabled(false)Attention
この関数はAirbridgeがトラッキングを始める前に実行される必要があります。つまり、
autoStartTrackingがtrueになっている場合はgetInstanceの前、falseになっている場合はstartTrackingの前に実行されなければいけません。
このように設定されていなければ、この機能は動作しません。
Airbridge SDKはアプリ内でトラッキングリンクを開ける機能を提供し、ブラウザを通さなくても他の画面に遷移することができます。
// 有効化Airbridge.setResetEventBufferEnabled(true) // 無効化Airbridge.setResetEventBufferEnabled(false)トラッキングリンクがクリックされた時に呼び出します。トラッキングリンクのクリックの統計を追加し、設定されたアプリ、ウェブまたはフォールバックに移動します。
トラッキングリンクがUIに表示された時に呼び出します。トラッキングリンクのインプレッションの統計を1つ追加します。
Attention
カスタムドメインを使用している場合、カスタムShort IDを含むトラッキングリンクは使用できません。
example1) http://deeplink.ab180.co/custom → 使用不可
example2) http://deeplink.ab180.co/a3b1c2 → 使用可能
example3) https://abr.ge/a3b1c2 → 使用可能
Airbridgeのライフサイクルイベントのうち、アプリがバックグラウンドに移動し、セッション中に発生するライフサイクルイベントは基本的に収集されません。このオプションを使用すれば、これらのイベントを収集することができます。
[AirBridge.setting setTrackInSessionLifeCycleEventEnabled:YES];AirBridge.setting().setTrackInSessionLifeCycleEventEnabled(true)Airbridgeの全ての動作を無効化できる機能です。アプリのライフサイクルのトラッキング、イベントの送信など、Airbridgeの全ての機能が停止します。
// 有効化Airbridge.setResetEventBufferEnabled(true) // 無効化Airbridge.setResetEventBufferEnabled(false)Attention
この関数はAirbridgeの初期化コード(
getInstance)より先に実行される必要があります。そうでなければ、この機能は動作しません。
WebViewのウェブサイトにインストールされたウェブSDKが送信するイベントをiOS SDKが代わりに送信することができます。
以下のようにWebViewのconfigurationのcontrollerにAirbridgeのウェブインタフェースを追加してください。
WKWebViewConfiguration* configuration = [[WKWebViewConfiguration alloc] init]; WKUserContentController* controller = [[WKUserContentController alloc] init];[AirBridge.webInterface injectTo:controller withWebToken:@"YOUR_WEB_TOKEN"]; configuration.userContentController = controller; WKWebView* webview = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration];let configuration = WKWebViewConfiguration() let controller = WKUserContentController()AirBridge.webInterface()?.inject(to: controller, withWebToken: "YOUR_WEB_TOKEN") configuration.userContentController = controller webView = WKWebView(frame: .zero, configuration: configuration)YOUR_WEB_TOKEN はダッシュボードの Settings > Tokens > Web SDK Token で確認できます。
アプリで自動入力機能を使ってパスワードを保存している場合、webcredentials:... の設定をしなければ、パスワードが applinks:YOUR_APP_NAME.airbridge.io または applinks:YOUR_APP_NAME.deeplink.page のドメインに保存されます。
パスワードが保存されるドメインを変更したい場合、example.com を設定するドメインに変更し、以下のように設定してください。
https://example.com/.well-known/apple-app-site-association のURLで以下の内容をホスティングする必要があります。
{ "webcredentials": { "apps": ["TEAM_ID.APP_BUNDLE_ID"] }}TEAM_ID.APP_BUNDLE_ID 例) 9JA89QQLNQ.com.apple.wwdc
Xcode> Projectファイル> Signing & Capabilities> Associated Domainsに移動してください。
+ボタンをクリックして webcredentials:example.comを追加してください。
Airbridge iOS SDKはV1.28.0からBitcodeをサポートしていません。(Xcode 14からBitcodeサポートが終了しました。)
アプリプロジェクトでBitcodeを使う場合、以下のようなコンパイルエラーが発生する可能性があります。
Textld: XCFrameworkIntermediates/AirBridge/AirBridge.framework/AirBridge(AirBridge-arm64-master.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)この問題を解決するには、Podfileファイルに以下のような内容を追加するか、
installer.pods_project.targets.each do |target| target.build_configurations.each do |configuration| configuration.build_settings['ENABLE_BITCODE'] = 'NO' endendXcodeでENABLE_BITCODEの設定をNOにしてください。
Apple AppstoreではBitcodeのサポートを終了し、Bitcodeを使う.ipaファイルが提出されても自動でBitcodeを除去します。
Airbridge iOS SDKはV1.28.0からXcode 13及びiOS 9、10をサポートしていません。
サポートが必要な場合、Airbridge iOS SDK V1.27.0以下のバージョンを利用してください。
名称 | 説明 | 制限 |
|---|---|---|
ID | ユーザーID | - |
ユーザーのEメール | 自動でSHA256ハッシュ化(オプションで解除可能) | |
Phone | ユーザーの電話番号 | 自動でSHA256ハッシュ化(オプションで解除可能) |
Alias | ユーザーの別のID | - 最大10個までです。 |
名称 | 説明 | 制限 |
|---|---|---|
Attributes | ユーザー属性 | - 最大100個までです。 |
メソッド | 説明 |
|---|---|
| 送信したキーと値のペアをデバイス識別子に追加します。 |
| 送信したキーに該当するデバイス識別子を削除します。該当する識別子がない場合、動作はありません。 |
| 全てのデバイス識別子を削除します。 |
パラメータ | 説明 |
|---|---|
setCategory | イベント名 (required) |
setAction | イベントの分類1 |
setLabel | イベントの分類2 |
setValue | イベントのカスタム値 |
setCustoms | イベントのカスタム情報 |
setSemanticAttributes | イベントのセマンティック情報 (Map) |
このページは役に立ちましたか?