向您的Adobe Marketing Cloud应用程序添加Branch深层链接和属性的功能。借助Branch的链接平台,移动开发人员和营销人员可以通过世界一流的深层链接和归因来发展他们的移动业务。
特征
- 使用Adobe SDK跟踪的所有事件将自动发送到Branch,而无需进行任何其他工作
- 所有核心分支功能均可访问
要求
- iOS 10以上
- Adobe核心平台
兼容iOS 14
为了帮助您全面管理用户体验,Branch SDK 将不会触发 IDFA 许可模式。
然而,如果您选择触发这一模式,在可行的情况下,Branch 仍然可以收集并使用 IDFA。
不需要Branch SDK
由于Adobe Branch扩展是自动包含Branch SDK的子依赖项的包装,因此您无需-也不建议在应用中单独实现Branch SDK。
示例应用
可以在Examples/AdobeBranchExample
项目的AdobeBranchExtension-iOS存储库中找到示例应用程序。
安装及使用
请注意,Adobe Experience Platform(AEP)SDK和AdobeMobileLibrary不能共存于同一项目中。
这是有关如何在应用程序中使用AdobeBranchExtension的简要概述:
- 您需要配置您的应用程序,并在Branch Metrics仪表板中获取Branch API密钥。您可以在此处的分支文档中阅读有关配置仪表板的更多信息。
- 对于深层链接,您需要按照以下分支文档中的说明为通用链接添加关联的域:
- 还将应用程序URI方案和分支键添加到应用程序的plist文件中,以进行深层链接。
- 在Adobe仪表板中,激活“分支”并将您的“分支”密钥添加到应用程序的配置中。
- 将AdobeBranchExtension添加到应用程序的Podfile。
pod 'AdobeBranchExtension'
- 运行
pod install
和pod update
会安装扩展的最新版本。 - 用
ACPCore
indidFinishLaunchingWithOptions
注册BranchAdobeBranchExtension
:
#import <AdobeBranchExtension/AdobeBranchExtension.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
[ACPCore registerExtension:[AdobeBranchExtension class] error:&error]
...
return YES; // Important! If you return `NO` iOS will not handle deep linking as expected.
}
- 如下所示,在AppDelegate类中的三个位置添加分支深层链接路由器和接收器。您可以在此文档看到一些有关深度链接路由的 最佳实践。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Up here you register your AdobeBranchExtension with ACPCore
// Handle your Branch deep link routing in the callback
[AdobeBranchExtension initSessionWithLaunchOptions:launchOptions
andRegisterDeepLinkHandler:^(NSDictionary * _Nullable params, NSError * _Nullable error) {
if (!error && params && [params[@"+clicked_branch_link"] boolValue]) {
// EXAMPLE ROUTING CODE
// Product*product = Product.new;
// product.name = params[@"$og_title"];
// product.summary = params[@"$og_description"];
// product.URL = params[@"$canonical_url"];
// product.imageName = params[@"image_name];
// product.imageURL = params[@"$og_image_url"];
//
// ProductViewController *pvc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ProductViewController"];
// pvc.title = product.name;
// pvc.product = product;
// [((UINavigationController *)self.window.rootViewController) pushViewController:pvc animated:YES];
}
}];
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
[AdobeBranchExtension application:application openURL:url options:options];
return YES;
}
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void(^)(NSArray<id<UIUserActivityRestoring>> * __nullable restorableObjects))restorationHandler {
[AdobeBranchExtension application:application continueUserActivity:userActivity];
return YES;
}
实现分支功能
添加AdobeBranchExtension和Branch后,您始终可以直接使用Branch功能。您可以在 iOS的分支文档中了解有关使用分支功能的信息。
自动:跟踪动作和状态
当您在Adobe Launch中跟踪动作和状态时,动作和状态消息也会发送到Branch并显示在
分支仪表板。这使您可以跟踪深层链接活动和病毒共享在应用程序操作中的有效性。
以下是通过Adobe Launch跟踪应用程序状态的示例:
[ACPCore trackState:@"VIEW" data:@{
@"name": self.product.name,
@"revenue": @"200.0",
@"currency": @"USD"
}];
4个月前更新