Skip to content

Commit 127eaef

Browse files
Merge pull request #5192 from segmentio/react-native-branch-metrics
feat: add branch metrics to react native dest. plugin catalog
2 parents 908342a + 130f858 commit 127eaef

File tree

2 files changed

+90
-8
lines changed

2 files changed

+90
-8
lines changed

src/connections/sources/catalog/libraries/mobile/react-native/destination-plugins/branch-react-native.md

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,91 @@ title: Analytics React Native Branch Plugin
33
strat: react-native
44
---
55

6-
[Braze](https://www.braze.com/), formerly Appboy, is an engagement platform that empowers growth by helping marketing teams to build customer loyalty through mobile, omni-channel customer experiences.
6+
[Branch](https://branch.io/?utm_source=segmentio&utm_medium=docs&utm_campaign=partners){:target="_blank”} empowers you to increase mobile revenue with enterprise-grade links built to acquire, engage, and measure customers across all devices, channels, and platforms. An industry-leading mobile measurement and deep linking platform, trusted by top ranking apps to increase efficiency and revenue.
77

8-
Braze’s destination plugin code is open source and available on GitHub. You can view it [here.](https://github.com/braze-inc/analytics-swift-braze). This destination plugin is maintained by Braze. For any issues with the destination plugin code, please reach out to Braze's support.
8+
## Getting started
99

10-
## Getting Started
10+
1. From the Segment web app, click **Catalog**.
11+
2. Search for "Branch Metrics" in the Catalog, select it, and choose which of your sources to connect the destination to.
12+
3. On Branch side you will need to [sign up for a free Branch account](http://branch.io/signup?bmp=segment){:target="_blank”} and follow the steps on their Dashboard to complete set up.
13+
4. Copy your `Branch Key` from the Settings page of your [Branch dashboard](https://dashboard.branch.io/#/settings){:target="_blank”}.
14+
5. Paste the Branch Key in the destination settings and click **Save**.
1115

1216

13-
1. From the Segment web app, click **Catalog**.
14-
2. Search for "Braze" in the Catalog, select it, and choose which of your sources to connect the destination to.
15-
3. In the Destination Settings, add the **API Key**, found in the Braze Dashboard in *App Settings > Manage App Group*.
16-
4. Set up a new App Group REST API Key in the Braze Dashboard in *App Settings > Developer Console > API Settings*. For more information, see [Creating and Managing REST API Keys](https://www.braze.com/docs/api/basics/#creating-and-managing-rest-api-keys) in the Braze documentation.
17-
- Select the `users.track` endpoint in the **User Data** section.
17+
## Installation
18+
19+
You need to install the `@segment/analytics-react-native-plugin-branch` and the `react-native-branch` dependencies to use the Branch plugin.
20+
21+
Using NPM:
22+
```bash
23+
npm install --save @segment/analytics-react-native-plugin-branch react-native-branch
24+
```
25+
26+
Using Yarn:
27+
```bash
28+
yarn add @segment/analytics-react-native-plugin-branch react-native-branch
29+
```
30+
31+
Run `pod install` after the installation to autolink the Branch SDK.
32+
33+
See the [Branch React Native SDK](https://github.com/BranchMetrics/react-native-branch-deep-linking-attribution){:target="_blank”} docs for more information about this dependency.
34+
## Usage
35+
36+
Follow the [instructions for adding plugins](https://github.com/segmentio/analytics-react-native#adding-plugins){:target="_blank”} on the main Analytics client.
37+
38+
In your code where you initialize the analytics client, call the `.add(plugin)` method with an `BranchPlugin` instance:
39+
40+
```ts
41+
import { createClient } from '@segment/analytics-react-native';
42+
43+
import { BranchPlugin } from '@segment/analytics-react-native-plugin-branch';
44+
45+
const segmentClient = createClient({
46+
writeKey: 'SEGMENT_KEY'
47+
});
48+
49+
segmentClient.add({ plugin: new BranchPlugin() });
50+
```
51+
52+
## Identify
53+
54+
If you're not familiar with the Segment Spec, take a moment to understand what the [Identify method](/docs/connections/spec/identify/) does. An example call looks like this:
55+
56+
```ts
57+
const { identify } = useAnalytics();
58+
59+
identify('user-123', {
60+
username: 'MisterWhiskers',
61+
62+
plan: 'premium',
63+
});
64+
```
65+
66+
When you call `.identify('userId')`, Segment uses Branch's `setIdentity(userId)` method to send the `userId` that was passed in.
67+
68+
## Track
69+
70+
If you're not familiar with the Segment Spec, take a moment to understand what the [Track method](/docs/connections/spec/track/) does. An example call looks like this:
71+
72+
```ts
73+
const { track } = useAnalytics();
74+
75+
track('View Product', {
76+
productId: 123,
77+
productName: 'Striped trousers',
78+
});
79+
```
80+
81+
When you call `track`, Segment translates it automatically and sends the event to Branch's `logEvent()` endpoint.
82+
83+
## Screen
84+
If you're not familiar with the Segment Spec, take a look to understand what the [Screen method](/docs/connections/spec/screen/) does. An example call looks like this:
85+
86+
```ts
87+
const { screen } = useAnalytics();
88+
89+
screen('ScreenName', {
90+
productSlug: 'example-product-123',
91+
});
92+
```
93+
Segment sends Screen Events to Branch's `logEvent()` endpoint.

src/connections/sources/catalog/libraries/mobile/react-native/destination-plugins/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ plugins:
2020
url: https://d3hotuclm6if1r.cloudfront.net/logos/appsflyer-default.svg
2121
mark:
2222
url: https://cdn.filepicker.io/api/file/AnJUEBvxRouLLOvIeQuK
23+
- name: Branch
24+
url: connections/sources/catalog/libraries/mobile/react-native/destination-plugins/branch-react-native/
25+
logo:
26+
url: https://cdn.filepicker.io/api/file/Svc4UAgORe668HOiiyjd
27+
mark:
28+
url: https://cdn.filepicker.io/api/file/MfCJKP6VRoaLMG7sMY5m
2329
- name: Braze
2430
url: connections/sources/catalog/libraries/mobile/react-native/destination-plugins/braze-react-native/
2531
logo:

0 commit comments

Comments
 (0)