-
Notifications
You must be signed in to change notification settings - Fork 379
adding new swift plugin docs for 1flow #5369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
...tions/sources/catalog/libraries/mobile/apple/destination-plugins/1flow-swift.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
title: 1Flow Swift Plugin | ||
--- | ||
|
||
[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. | ||
|
||
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. | ||
|
||
## Getting started | ||
|
||
1. From the Segment web app, click **Catalog**, then search for **1Flow Mobile Plugin**. | ||
2. Click **Add Destination**. | ||
4. Select an existing Source to connect to 1Flow Mobile Plugin. | ||
5. Go to 1flow.ai -> Settings -> Project Settings, copy the 1Flow project key, and paste it into the Destination Settings in Segment. | ||
6. Depending on the mobile source you’ve selected, include 1Flow's library by adding the following lines to your dependency configuration. | ||
|
||
## Adding the dependency | ||
|
||
### Through Xcode | ||
|
||
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 repository. | ||
``` | ||
https://github.com/1Flow-Inc/segment-1flow-ios.git | ||
``` | ||
|
||
|
||
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. | ||
|
||
### Through Package.swift | ||
|
||
Open your Package.swift file and add the following to the `dependencies` section: | ||
|
||
``` | ||
.package( | ||
name: "Segment", | ||
url: "https://github.com/1Flow-Inc/segment-1flow-ios.git", | ||
from: "1.0.0" | ||
), | ||
``` | ||
|
||
## Using the Plugin in your App | ||
|
||
Open the file where you setup and configure the Analytics-Swift library. Add this plugin to the list of imports. | ||
|
||
``` | ||
import Segment | ||
import SegmentOneFlow // <-- Add this line | ||
``` | ||
|
||
Just under your Analytics-Swift library setup, call `analytics.add(plugin: ...)` to add an instance of the plugin to the Analytics timeline. | ||
|
||
``` | ||
let analytics = Analytics(configuration: Configuration(writeKey: "<YOUR WRITE KEY>") | ||
.flushAt(3) | ||
.trackApplicationLifecycleEvents(true)) | ||
analytics.add(plugin: OneFlowDestination()) | ||
``` | ||
|
||
## Identify | ||
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: | ||
|
||
```swift | ||
analytics.identify(userId: "[email protected]", traits: [ | ||
"name": "Peter Gibbons", | ||
"email": "[email protected]", | ||
"mobile": 1234567890 | ||
]) | ||
``` | ||
When you call identify method of segment, it will be equivalent to `logUser` of 1Flow. `userId` will be `userID` and `traits` will be `userDetails`. | ||
|
||
## Track | ||
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: | ||
|
||
```swift | ||
analytics.track(name: "ButtonClicked") | ||
``` | ||
Any value passed in `name`, will be eventName and if you have passed any event property, then it will be event `parameters`. | ||
|
||
## Screen | ||
|
||
Send [Screen](/docs/connections/spec/screen) calls to record which mobile app screens users have viewed. For example: | ||
|
||
```swift | ||
analytics.screen(title: "Home") | ||
``` | ||
|
||
Segment sends Screen calls to 1Flow as a `screen_[name]` event (or `screen_view` if a screen name isn't provided). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rohantryskybox I have added this page as we provide each swift plugin a unique page. Can you confirm these setup instructions are accurate for your plugin?
For more context, this is in line with the setup instructions shown for all the other swift plugins:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tcgilbert
This looks good.
Thanks