Segment (Export)

概述

只需按一下键,您便可以将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 发送什么事件?

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. You can see the list of fields that we send to Segment here.

🚧

不支持 WebSDK 事件

我们不支持 BranchWebSDK 事件的 Segment 导出。

它是什么样子的?

Branch 事件将在您的 Segment 调试器中显示为以 branch_ 开头的事件。

图片图片

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

图片图片

设置

先决条件

  • 本指南要求您已经集成了 Branch 以及 Segment 移动 SDK。

检索 Segment Token

找到您的 Segment Token,并将其输入到 Branch 操作后台 (Dashboard)。

  1. Navigate to https://app.segment.com and log into the Dashboard.

  2. 在操作后台 (Dashboard)中,前往所需的工作区。

  3. 在该工作区中,前往 Sources 并选择列出您的应用的 source。Branch 还不是一个独立的 source,因此 Branch 事件会出现在您的应用的 source 中。

    图片图片

  4. 点击进入Settings > API Keys

    图片图片

  5. 复制您的 Key 和 Secret—您需在1分钟内将其输入到 Branch 操作后台 (Dashboard)中。

启用集成

  1. On the Branch Dashboard (dashboard.branch.io), navigate to the Integrations page.

  2. 搜索 Segment,然后点击图块。

  3. 输入您的 Segment Token,然后点击 Enable

    图片图片

🚧

请测试集成!

Branch 对不正确的 API Key 概不负责。

纯滴匿名的 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.

高级

Branch 发送到 Segment 的内容

属性来源于例如
eventBranchEvent事件名称branch_OPEN
event_id事件的 unique IDBranch 事件 ID469939270182891107
propertiesBranch Link 数据 Dictionary事件归因于链接的最后归因触点数据"campaign": "Segment test", "channel": "Slack"
device_info设备数据,如操作系统设备的 Branch 用户数据"os": "ANDROID"
anonymousIdSegment 匿名 IDSegment SDK 提供的匿名 ID12356
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.

筛选项