Connect Branch and Mixpanel to unlock a more holistic picture of the customer journey for your app.



只需按一下键,便可以将 Branch 数据发送到 Mixpane 操作后台 (Dashboard),以帮助您了解 Branch 作为获客途径的功能。


将 Branch SDK 集成到应用后,Branch 可以检测到哪些链接产生了安装,重新打开和用户操作。启用此集成并提供您的 Mixpanel Token 后,Branch 将以 Mixpanel 期望的格式将引用的事件自动转发到 Mixpanel。

Branch Events Sent to Mixpanel

Branch will send referred installs and opens, commerce, content, user lifecycle, as well as any custom events you track with Branch. Non-referred events, clicks, web session starts, and pageviews will be excluded. Branch also sends all the data that is attached to the link that drove the referred event. This will allow you to analyze which campaigns, channels, etc. are helping you acquire and engage users. You can see the list of fields that we send to Mixpanel here.


Branch events will appear alongside your other tracked events in Mixpanel. These events will automatically have [Branch] prepended.


此外,单个事件(例如,在实时视图中看到的事件或在查看人员时可见的事件)将包括 Branch Link数据。以这里为例:


Branch 事件类似于 Mixpanel 事件,因为它们可以在您现有的渠道中使用,并可以在各种页面和操作后台 (Dashboard)上进行追踪。但是,与正常事件不同,Branch 事件首先包含有关用户最终如何进入您的应用的重要信息。


In order to enable Mixpanel, you need to have completed the following:

  1. Admin access to your Branch Dashboard.
  2. Enabled Data Feeds for your Branch account.
  3. Implemented the Branch SDK into your mobile app (iOS | Android)
  5. Admin access to your Google Analytics account.

Enable Mixpanel

1. Retrieve IDs from Mixpanel

对于基本的无代码集成:找到您的 Mixpanel Token,并将其输入到 Branch Dashboard 中。

  1. Navigate to https://mixpanel.com and log into the Dashboard.
  2. 在页面顶部的导航栏中点击 Account
  3. 在弹窗中选择 Projects ,然后复制应用的 Token:

2. Connect Mixpanel in Branch

In the Branch Dashboard in Data Feeds → Data Integrations tab, find and search for Google Analytics.

Enter the Android and iOS tokens from the previous step, then hit Enable.


Note: If you only have one Measurement/Tracking ID, then enter the same ID for both iOS and Android.

3. Pass Metadata to the Branch SDK



Developers on your mobile app are required for this step

请确保您重新使用 Branch iOS SDK 0.12.2 或更高版本以及 Android SDK v1.12.1 或更高版本。

除了基本的集成之外,您还应该在应用中添加少量代码。这将使 Branch SDK 可以将用户的 Mixpanel 唯一 ID 传递给我们的服务器。然后,Branch 将在记录任何事件时将该唯一 ID 传递给 Mixpanel。


在初始化 Branch 会话之前,请添加以下内容:

[[Branch getInstance] setRequestMetadataKey:@"$mixpanel_distinct_id" value:[Mixpanel sharedInstance].distinctId];
Branch.getInstance().setRequestMetadataKey("$mixpanel_distinct_id", value: Mixpanel.mainInstance().distinctId)


在应用的 #onCreate 或 Activity 的 #onCreate 中初始化 Branch 后,请立即调用以下行:

MixpanelAPI mp = MixpanelAPI.getInstance(this, "<your project token>");
Branch.getInstance().setRequestMetadata("$mixpanel_distinct_id", mp.getDistinctId());

For more information, see Why We Recommend Passing Mixpanel Distinct ID.


Mixpanel 唯一 ID 更改

如果您在用户使用应用时随时更改其 Mixpanel 唯一ID,则应调用与上述相同的一行代码。这样,将来从 Branch 到 Mixpanel 的调用将使用更新的唯一 ID。

适用于 iOS 的示例:

[[Branch getInstance] setRequestMetadataKey:@"$mixpanel_distinct_id" value:@"User A"];

4. Verify Data Sent

Once the above steps are complete, you are now ready to start launching campaigns. Branch-attributed conversions will be sent to Mixpanel. To verify data is being sent from Branch to Mixpanel, you can look at the Branch Dashboard's Liveview Webhook Records and apply the following filter:

webhook partner keyequalsdi_mixpanel


Wait Period

Please be patient as data may take some time to flow through Branch's attribution systems and onto Mixpanel. If data has not appeared in Mixpanel after 30 minutes of completing a test conversion, review the above steps to see if you may have missed something.


For a high level overview of identities in Mixpanel, see Identity Management in Mixpanel. If you experience any issues regarding tracking identities or have general questions about the .alias() and .identify() methods, please take a look at Mixpanel's documentation first. Additionally, reach out to [email protected] if the problem persists.


Branch 发送到 Mixpanel 的内容

Property 名称来源于例如要求
properties.distinct_id设备/用户的 unique ID查看下面的部分AEBE52E7-03EE-455A-B3C4-E57283966239N
properties.tokenMixpanel TokenBranch 操作后台 (Dashboard)eed14a8aaa8c8ef777b8e9cb30826399Y
properties.ANY-KEY (许多)与 Key 关联的值事件 metadata或推荐链接数据〜频道:facebookN

为什么我们推荐传递 Mixpanel 唯一 ID

如果 Mixpanel 使用的任何标识符可用,那么 Branch 将自动指定 Mixpanel 请求的 Distinct ID。在 iOS 上,Branch 将发送 IDFA(如果存在)或 identifierForVendor(IDFV)(如果存在),否则将忽略唯一 ID。在 Android 上,Branch 将发送 Google Advertising ID(如果存在),或者发送 Android ID(硬件ID)(如果存在),否则将省略 Distinct ID。

在 iOS 上,默认情况下,Mixpanel SDK 将使用 IDFA(如果存在),否则将使用 identifierForVendor(IDFV)(也称为供应商 ID 或 identifierForVendor)。在 IdentifierForVendor(IDFV)不可用的极少数情况下,它将生成一个随机 UUID。为了使 IDFA 可用,请确保您已包含 AdSupport.framework。

在 Android 上,默认情况下,Mixpanel SDK 不使用 Google Advertising ID 或 Android ID(硬件 ID)。而是生成一个随机的 UUID。这意味着在 Android 上,如果您不传递 Branch 的 Mixpanel Distinct ID,我们将无法正确地将 Branch 生成的事件与 Mixpanel 标识的用户相关联。


具有多种设备和 Mixpanel 标识/别名的细微差别

如果您在用户使用应用时随时更改其 Mixpanel 唯一 ID,则应调用与上述相同的一行代码。这样,将来从 Branch 到 Mixpanel 的调用将使用更新的唯一 ID。

此外,在一种情况下,事件将被记录到 Mixpanel,但未与正确的用户关联。这是由于 Mixpanel 端的身份限制所致。


用户拥有 iPhone 和 iPad



用户以自然方式打开应用(不是从 Branch Link 中打开),并自动分配了 distinguishedId 1234(这是 IDFA)。然后,用户完成注册,通过 “User A” 的值调用了 alias() 并关联了 “1234 <> “User A” 。到目前为止一切都正常。

然后,该用户将被置于针对再次参与的电子邮件 Campaign 中。她正在 iPad 上检查电子邮件,然后点击指向该应用的 Branch Link。该应用已打开。我们向 Mixpanel 发送具有自动分配的 distinguishedId 5678(这是 IDFA)的参照事件。然后,用户登录,并使用值 “User A” 调用 Identify()。之所以调用 Identify() 是因为我们希望用户在两个具有相同 identity = User A 的设备上进行匹配。如果在第二种情况下调用 alias(),那么将有两个 distinctId(在 Mixpanel 的逻辑中,是两个不同的人) - 一个具有 distinctId 1234,另一个具有 distinctId5678。为了合并它们,我们必须在第二个设备上 identify() 用户。此逻辑不好的方面是,identify() 之前的动作未与同一用户关联,因为短暂存在两个 distinctId。

与 5678 关联的推荐事件不与1234 /“用户A”关联。

In order for any additional events on this device to be associated with "User A", the app should invoke the one line of code as recommended in the section Pass Mixpanel Distinct ID. Example:

[[Branch getInstance] setRequestMetadataKey:@"$mixpanel_distinct_id" value:@"User A"];

If there are ever workarounds for this, we will update this guide and notify our partners accordingly. Here is more information on how Mixpanel manages identities.

User Profile Properties

Branch does not support sending any User Profile Properties to Mixpanel. In order to set user properties, please follow Mixpanel's guide on setting a user profile property.