筛选项

Adobe Launch iOS SDK

向您的 Adobe Marketing Cloud 应用添加 Branch 深度链接和归因的功能。借助 Branch 的链接平台,移动开发人员和营销者可以通过世界一流的深度链接和归因来发展他们的移动业务。

功能

  1. 使用 Adobe SDK 追踪的所有事件将自动发送到 Branch,无需进行任何其他工作
  2. 所有核心 Branch 功能均可访问
  3. The SDK will automatically pick up the Adobe ID's

要求

  • iOS 10 以上
  • Adobe 核心平台

📘

兼容 iOS 14

为了帮助您全面管理用户体验,Branch SDK 将不会触发 IDFA 许可弹窗。

然而,如果您选择触发这一弹窗,在可行的情况下,Branch 仍然可以收集并使用 IDFA。

了解更多

👍

不需要 Branch SDK

由于 Adobe Branch 扩展是自动包含 Branch SDK 的子依赖项的包装,因此您无需(我们也不建议)在应用中单独使用 Branch SDK。

示例应用

An example app can be found in the AdobeBranchExtension-iOS repository, in the Examples/AdobeBranchExample 项目。

安装及使用

❗️

请注意,Adobe Experience Platform(AEP)SDK 和 AdobeMobileLibrary 不能共存于同一项目中。

这是有关如何在应用中使用 AdobeBranchExtension 的简要概述:

  1. You'll need to configure your app and get a Branch API key in the Branch Metrics dashboard. You can read more about configuring your dashboard in the Branch docs here.
  2. 对于深度链接,您需要按照以下 Branch 文档中的说明为 Universal Links 添加关联域(Associated Domain):
  3. 还将应用 URI scheme 和 Branch key 添加到应用的 plist 文件中,以进行深度链接。
  4. 在 Adobe 操作后台 (Dashboard)中,激活 Branch 并将您的 Branch key 添加到应用的配置中。
418
  1. 将 AdobeBranchExtension 添加到应用的 Podfile。
    pod 'AdobeBranchExtension'
  2. 运行 pod install and pod update do install the latest version of the extension.
  3. Register the Branch AdobeBranchExtension with ACPCore in didFinishLaunchingWithOptions
#import <AdobeBranchExtension/AdobeBranchExtension.h>
    ...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...
    // Register the Branch AdobeBranchExtension with APCCore
    [ACPCore registerExtension:[AdobeBranchExtension class] error:&error]
     ...
    return YES; // Important! If you return `NO` iOS will not handle deep linking as expected.
}
  1. Add the Branch deep link routers and receivers in your AppDelegate class in three places as shown below. You can see some best practices on deep link routing in this doc.
- (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;
}

NativeLink™ Deferred Deep Linking (iOS Only)

  • Use iOS pasteboard to enable deferred deep linking via Branch NativeLink™

🚧

先决条件

Make sure the underlying iOS SDK Version is v1.39.4+

To use this feature you must:

Implement one of the pasteboard opt-in options in the native iOS SDK code.

实现 Branch 功能

Once you've added the AdobeBranchExtension and Branch, you can always use Branch features directly. You can learn about using the Branch features here, in the Branch documentation for iOS.

Register ACPCore

There are two ways to register with ACPCore

  1. Access the hosted Adobe config by directly passing in the App ID:
// Option 1 - Access the Hosted Adobe Config by directly passing the Adobe App ID
[ACPCore configureWithAppId:@"replacewithyouradobeappid"];
  1. Configuring at runtime by updating the APCCore configuration:
//Option 2 - Configure at runtime
- (void) setupTestConfig {
    NSMutableDictionary *config = [NSMutableDictionary dictionary];
    
    // ============================================================
    // global
    // ============================================================
    config[@"global.privacy"] = @"optedin";
    config[@"global.ssl"] = @true;
    
    // ============================================================
    // Branch
    // ============================================================
    config[@"branchKey"] = @"replacewithyourbranchkey";
    
    // ============================================================
    // acquisition
    // ============================================================
    config[@"acquisition.appid"] = @"";
    config[@"acquisition.server"] = @"";
    config[@"acquisition.timeout"] = @0;
    
    // ============================================================
    // analytics
    // ============================================================
    config[@"analytics.aamForwardingEnabled"] = @false;
    config[@"analytics.batchLimit"] = @0;
    config[@"analytics.offlineEnabled"] = @true;
    config[@"analytics.rsids"] = @"";
    config[@"analytics.server"] = @"";
    config[@"analytics.referrerTimeout"] = @0;
    
    // ============================================================
    // audience manager
    // ============================================================
    config[@"audience.server"] = @"";
    config[@"audience.timeout"] = @0;
    
    // ============================================================
    // identity
    // ============================================================
    config[@"experienceCloud.server"] = @"";
    config[@"experienceCloud.org"] = @"";
    config[@"identity.adidEnabled"] = @false;
    
    // ============================================================
    // target
    // ============================================================
    config[@"target.clientCode"] = @"";
    config[@"target.timeout"] = @0;
    
    // ============================================================
    // lifecycle
    // ============================================================
    config[@"lifecycle.sessionTimeout"] = @0;
    config[@"lifecycle.backdateSessionInfo"] = @false;
    
    // ============================================================
    // rules engine
    // ============================================================
    config[@"rules.url"] = @"pathtoyourrulesfile";
    config[@"com.branch.extension/deepLinkKey"] = @"pictureId";
    config[@"deepLinkKey"] = @"pictureId";
    
    [ACPCore updateConfiguration:config];
}

Register an Event Allowlist

Selectively track certain events within Branch by registering a allowlist:

AdobeBranchExtension.configureEventTypes(["com.adobe.eventType.generic.track"],andEventSources:["com.adobe.eventSource.requestContent"])
[AdobeBranchExtension configureEventTypes:"com.adobe.eventType.generic.track" andEventSources:"com.adobe.eventSource.requestContent"];

Events can be allowlisted based on their event type and event source. The event type and event source can be defined using the following code snippet:

let event = try! ACPExtensionEvent(name: "event_name", type: "io.branch.type", source: "io.branch.source", data: [])
try! ACPCore.dispatchEvent(event)

Disable Event Sharing between Adobe/Branch

To disable Event Sharing between Adobe and Branch, add the following line of code:

// Disable event sharing
 [AdobeBranchExtension configureEventTypes:nil andEventSources:nil];
// Disable event sharing
[AdobeBranchExtension configureEventTypes:nil andEventSources:nil];

自动:追踪行为和状态

When you track actions and states in Adobe Launch, the action and state messages are sent to Branch too and shown on the Branch dashboards. This allows you to track the effectiveness of deep link campaigns and viral sharing in your app's actions.

以下是通过 Adobe Launch 追踪应用状态的示例:

[ACPCore trackState:@"VIEW" data:@{
@"name":        self.product.name,
@"revenue":     @"200.0",
@"currency":    @"USD"
}];

Define the Exclusion List of Event Names

🚧

Conflict

You can either define an exclusion list or an allow list of events but you can't define both. If you don't configure any, all events will send to Branch, which is not ideal.

// Define the Exclustion List of Event Names
if ([AdobeBranchExtension configureEventExclusionList:@[@"VIEW"] error:&error]) {
  NSLog(@"AdobeBranchExtension AllowList configured");
} else {
  NSLog(@"%@", error);
}

Define an Allow List of Event Names

🚧

Conflict

You can either define an allow list or an exclusion list of events but you can't define both. If you don't configure any, all events will send to Branch, which is not ideal.

// Define the Allow List of Event Names
if ([AdobeBranchExtension configureEventAllowList:@[@"VIEW"] error:&error]) {
  NSLog(@"AdobeBranchExtension AllowList configured");
} else {      
  NSLog(@"%@", error);
}

Register AdobeBranchExtension

Once the Allow or Exclusion list of event names has been configured, the AdobeBranchExtension needs to be registered.

// register AdobeBranchExtension
if ([ACPCore registerExtension:[AdobeBranchExtension class] error:&error]) {
  NSLog(@"AdobeBranchExtension Registered");
} else {
  NSLog(@"%@", error);
}