mParticle iOS

This documentation explains how to send mParticle events to your Branch dashboard. If you'd like to send Branch installs to your mParticle dashboard, please review the Branch/mParticle Data Integration.


这些说明适用于 mParticle SDK 版本7+集成

mParticle introduced a new attribution & deep linking API in v7 of their SDK (, so please contact your Branch or mParticle Account Managers for more details, if you have mParticle SDK < v7 installed in your app.


iOS 11.2 上 Universal Links 行为不一致

After updating a device to iOS 11.2, we found that the app's AASA file is no longer downloaded reliably onto your user’s device after an app install. As a result, clicking on Universal links will no longer open the app consistenly. You can set forced uri redirect mode on your Branch links to open the app with URI schemes. View details of the issue on the Apple Bug report.



iOS 14 实施

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

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


Branch 设置

配置 Bundle ID


确认应用前缀(App Prefix)


配置 Branch 操作后台 (Dashboard)并启用 Universal Links

1590 958

配置 Associated Domain

  • Add your link domains from your Branch Dashboard
  • -alternate is needed for Universal Linking with the Web SDK inside your Website
  • test- 要使用 test key 时需要
  • If you use a custom link domain, you will need to include your old link domain, your -alternate link domain, and your new link domain


  • 确认 entitlement 在 TARGETS 内

设置 info.pList

  • Add Branch Dashboard values

    • 添加 branch_app_domain with your live key domain
    • Add your URI scheme as URL Types > Item 0 > URL Schemes
    • 不要将您的 API key 添加到文件中(mParticle 通过操作后台 (Dashboard)进行处理)

mParticle 设置

在 mParticle 上启用 Branch

  • Before you can enable Branch in your mParticle dashboard, you must retrieve your Branch Key on the Link Settings page of your Branch dashboard.
  • Please follow mParticle's documentation on how to Connect an Event Output; i.e. enable the Branch integration.
  • If you have enabled Apple Search Ads for your Branch implementation, you must also check Enable Apple Search Ads in the Connection Settings.

在 mParticle 操作后台 (Dashboard)中添加了工具包并配置了 Branch API Key 之后,mParticle SDK 将负责初始化 Branch SDK 并转发适当的应用 Lifecycle Event 以处理深度链接。

安装 mParticle Branch 工具包

Option 1: CocoaPods

platform :ios, '8.0'

    target 'APP_NAME' do
      # if swift

      ‘pod 'mParticle-BranchMetrics', '~> 8'

Option 2: Carthage

github "mparticle-integrations/mparticle-apple-integration-branchmetrics"

导入 iOS Support Libraries

  • AdSupport
  • SafariServices
  • MobileCoreServices
  • CoreSpotlight
  • iAd

在 mParticle 工具包中初始化 Branch

mParticle iOS SDK(版本5.4.1和更高版本)将自动调用 Branch Kit 的以下方法:

  • initSessionWithLaunchOptions:application:didFinishLaunchingWithOptions:
  • handleDeepLink:application:openURL:options:
  • continueUserActivity:application:continueUserActivity:restorationHandler:

This means mParticle will automatically handle initializing Branch sessions. However, please ensure .onAttributionComplete is enabled in the mParticleOptions object.


mParticle appDelegate proxy 未启用

If the mParticle appDelegate proxy is not enabled, you must add mParticle's URI & Domain relays to the appDelegate.

此时,您应该开始在 Branch 操作后台 (Dashboard)中看到 Branch 会话数据(包括安装,重新打开和所有自定义事件)。

通过 mParticle 获得深度链接数据

我们与 mParticle 的集成支持创建和归属用于安装和打开应用的深度链接。深度链接通常将包含一些其他信息,这些信息将在用户最终打开您的应用时使用,以便您可以将用户正确地导到适当的内容,或者以其他方式自定义他们的体验。

Please ensure you've followed mParticle's documentation to ensure your deep link data is being retrieved.


React Native 中的 mParticle

If you integrate mParticle in React Native, you will still integrate the Branch kit as a Native module and follow the setup steps above. However, instead of retrieving deep link data in the the native layer, you'll retrieve deep link data via mParticle's React Native function found here.

NativeLink™ Deferred Deep Linking

  • 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.


  • Create a deep link from the Branch Dashboard
  • 从设备中删除您的应用
  • 在设备上编译和测试
  • Paste deep link in Apple Notes
  • 长按深度链接(而不是 3D Touch)
  • Click Open in "APP_NAME"to open your app


  • Please refer to mParticle's making direct calls to kits documentation for how to access the Branch kit via the mParticle SDK.
  • Once you have a reference to the Branch kit, refer to Branch's native iOS SDK documentation on how to implement secondary functionality.



Please refer to the Branch iOS SDK troubleshooting section.