Segment (Export)
Send Branch data to Segment to unlock a more holistic picture of the customer journey for your app.

概述
只需按一下键,您便可以将Branch数据发送到 Segment 操作后台 (Dashboard),以帮助您了解 Branch 作为获客途径的功能,将数据导出到整个分析工具套件,并在 Branch 数据上建立自定义的受众群体。
This documentation explains how to send Branch-referred events to Segment. If you'd like to send Segment events to your Branch dashboard, please review the Segment Import integration.
它是如何工作的?
将 Branch SDK 集成到应用后,Branch 可以检测到哪些链接导致安装,重新打开和用户操作。启用此集成并提供您的 Segment 凭据,将帮助 Branch 自动以 Segment 受众群期望的格式将属性事件转发给 Segment 受众群。
Branch events sent to Segment
Branch will send attributed installs and opens, as well as any content events, lifecycle events,custom events and commerce 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.
属性 | 值 | 来源于 | 例如 |
---|---|---|---|
event | BranchEvent | 事件名称 | branch_OPEN |
event_id | 事件的 unique ID | Branch 事件 ID | 469939270182891107 |
properties | Branch Link 数据 Dictionary | 事件归因于链接的最后归因触点数据 | "campaign": "Segment test", "channel": "Slack" |
device_info | 设备数据,如操作系统 | 设备的 Branch 用户数据 | "os": "ANDROID" |
anonymousId | Segment 匿名 ID | Segment SDK 提供的匿名 ID | 12356 |
IP | 事件 IP | 设备 | 192.82.115.928 |
以上所有属性均作为 flat 接收 properties[key], even though some are stored as dictionaries in Branch. They are grouped in our documentation for legibility.
不支持 WebSDK 事件
We do not support Segment export for Branch WebSDK events
它是什么样子的?
Branch 事件将在您的 Segment 调试器中显示为以 branch_ 开头的事件。

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

先决条件
In order to enable Segment (export), you need to have completed the following:
- Admin access to your Branch Dashboard.
- Enabled Data Feeds for your Branch account.
- Contact your Branch account manager or visit https://branch.io/pricing
- Implemented the Branch SDK into your mobile app (iOS | Android)
- Implement the Segment mobile SDK
- Admin access to your Segment account.
Enable Segment (Export)
1. Retrieve your Segment Token
找到您的 Segment Token,并将其输入到 Branch 操作后台 (Dashboard)。
- Navigate to https://app.segment.com and log into the Dashboard.
- 在操作后台 (Dashboard)中,前往所需的工作区。
- 在该工作区中,前往 Sources 并选择列出您的应用的 source。Branch 还不是一个独立的 source,因此 Branch 事件会出现在您的应用的 source 中。

- 点击进入Settings > API Keys

- 复制您的 Key 和 Secret—您需在1分钟内将其输入到 Branch 操作后台 (Dashboard)中。
2. Enable Segment (Export) in Branch
- On the Branch Dashboard (dashboard.branch.io), navigate to the Integrations page.
- 搜索 Segment,然后点击图块。
- Enter your Segment Token under the "Export" section and hit Enable.

3. Configure App
纯滴匿名的 Segment ID
When you're ready to send data through Branch, you'll need to make sure you pass through the configured Segment Anonymous ID the Branch SDKs. In order to do so, you'll ask the Segment SDK to provide you with the Segment Anonymous ID, and pass this value through setRequestMetadataKey
on the Branch SDKs.
Here's a sample snippet showing this. NOTE you must set the correct key before calling sessionBuilder()...init()
. You must also initialize the Segment SDK before setting the request metadata in the Branch SDK.
iOS
内部 didFinishLaunchingWithOptions
Branch *branch = [Branch getInstance];
[[Branch getInstance] setRequestMetadataKey:@"$segment_anonymous_id" value:[[SEGAnalytics sharedAnalytics] getAnonymousId]];
Swift
内部 didFinishLaunchingWithOptions
if let branch = Branch.getInstance() {
branch.setRequestMetadataKey("$segment_anonymous_id", value:"1234" as NSObject!);
}
Android
在应用中初始化之前 #onCreate 或 Deep Link Activity #onCreate。
Branch.getInstance().setRequestMetadata("$segment_anonymous_id", com.segment.analytics.Analytics.with(this).getAnalyticsContext().traits().anonymousId());
...
Branch.sessionBuilder(this)...init();"
In the above snippet, this
is the Activity context.
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 Segment. To verify data is being sent from Branch to Segment, you can look at the Branch Dashboard's Liveview Webhook Records and apply the following filter:
Filter | Operator | 值 |
---|---|---|
webhook partner key | equals | di_segment |
Updated 2 months ago