Skip to content

Commit 097e6f0

Browse files
Merge pull request #5322 from rohantryskybox/1Flow-iOS
1Flow iOS doc update
2 parents 2ea3ea0 + 4986aad commit 097e6f0

File tree

1 file changed

+131
-0
lines changed
  • src/connections/destinations/catalog/test-flow

1 file changed

+131
-0
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
title: 1Flow Mobile Plugin Destination
3+
id: 64dd07c1fed86b6866cd93f5
4+
beta: true
5+
hidden: true
6+
---
7+
8+
[1Flow](https://1flow.ai/?utm_source=segmentio&utm_medium=docs&utm_campaign=partners){:target="_blank"} is a leading in-app user survey and messaging platform for Mobile app and SaaS businesses.
9+
10+
Using 1Flow, you can reach users _in-the-moment_ while they are interacting with your website or application, to collect highly contextual user insights that help you improve your product offering and customer experience
11+
12+
The 1Flow Mobile Plugin Destination is open-source and available on GitHub. You can view these repositories here:
13+
14+
- [iOS](https://github.com/1Flow-Inc/Segment1Flow.git){:target="_blank"}
15+
- [Android](https://github.com/1Flow-Inc/1flow-segment-tool.git){:target="_blank"}
16+
17+
This destination is maintained by 1Flow. For any issues with the destination, [contact Support team](mailto:[email protected]).
18+
19+
## Getting started
20+
21+
1. From the Segment web app, click **Catalog**, then search for **1Flow Mobile Plugin**.
22+
2. Click **Add Destination**.
23+
4. Select an existing Source to connect to 1Flow Mobile Plugin.
24+
5. Go to 1flow.ai -> Settings -> Project Settings, copy the 1Flow project key, and paste it into the Destination Settings in Segment.
25+
6. Depending on the mobile source you’ve selected, include 1Flow's library by adding the following lines to your dependency configuration.
26+
27+
## iOS
28+
29+
### Step 1: Add Segment1Flow Package using Swift Package Manager
30+
31+
In the Xcode File menu, click Add Packages. You'll see a dialog where you can search for Swift packages. In the search field, enter the URL to this repo.
32+
33+
https://github.com/1Flow-Inc/Segment1Flow
34+
35+
You'll then have the option to pin to a version, or specific branch, as well as which project in your workspace to add it to. Once you've made your selections, click the Add Package button.
36+
37+
### Step 2: Initialise Segment and Add 1Fow Destination
38+
39+
```
40+
let config = Configuration(writeKey: "YOUR_WRITE_KEY_HERE")
41+
let analytics = Analytics(configuration: config)
42+
analytics.add(plugin: OneFlowDestination())
43+
```
44+
45+
## Android
46+
47+
### Step 1: Install 1Flow-Segment-Tool
48+
49+
- If gradle version is 6.5 or lower, include the below repository in your project's build.gradle file:
50+
51+
```
52+
allprojects{
53+
repositories{
54+
google()
55+
jcenter()
56+
maven{url 'https://jitpack.io'}
57+
}
58+
}
59+
```
60+
61+
- If gradle version is higher than 6.5, add the below code in settings.gradle.
62+
63+
```
64+
dependencyResolutionManagement {
65+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
66+
repositories {
67+
google()
68+
mavenCentral()
69+
maven{url 'https://jitpack.io'}
70+
}
71+
}
72+
```
73+
74+
- Add dependency in your app's build.gradle file:
75+
76+
```
77+
compileSdkVersion 34
78+
....
79+
defaultConfig {
80+
....
81+
minSdkVersion 21
82+
}
83+
dependencies {
84+
....
85+
implementation 'com.segment.analytics.android:analytics:4.11.3'
86+
implementation "com.github.1Flow-Inc:1flow-segment-tool:2023.09.14"
87+
}
88+
```
89+
90+
### Step 2: Initialize Segment and add 1Flow Destination
91+
```
92+
Analytics analytics = new Analytics.Builder(context, "YOUR_WRITE_KEY_HERE")
93+
.use(OneFlowIntegration.FACTORY)
94+
...
95+
.build();
96+
...
97+
Analytics.setSingletonInstance(analytics);
98+
99+
```
100+
101+
## Supported methods
102+
103+
### Identify
104+
If you're not familiar with the Segment Specs, take a look to understand what the [Identify method](/docs/connections/spec/identify/) does. An example call would look like:
105+
106+
```swift
107+
analytics.identify(userId: "[email protected]", traits: [
108+
"name": "Peter Gibbons",
109+
"email": "[email protected]",
110+
"mobile": 1234567890
111+
])
112+
```
113+
When you call identify method of segment, it will be equivalent to `logUser` of 1Flow. `userId` will be `userID` and `traits` will be `userDetails`.
114+
115+
### Track
116+
If you're not familiar with the Segment Specs, take a look to understand what the [Track method](/docs/connections/spec/track/) does. An example call would look like:
117+
118+
```swift
119+
analytics.track(name: "ButtonClicked")
120+
```
121+
Any value passed in `name`, will be eventName and if you have passed any event property, then it will be event `parameters`.
122+
123+
### Screen
124+
125+
Send [Screen](/docs/connections/spec/screen) calls to record which mobile app screens users have viewed. For example:
126+
127+
```swift
128+
analytics.screen(title: "Home")
129+
```
130+
131+
Segment sends Screen calls to 1Flow as a `screen_[name]` event (or `screen_view` if a screen name isn't provided).

0 commit comments

Comments
 (0)