Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smartlook/segment-swift-package
Segment add-on integration for Smartlook SDK
https://github.com/smartlook/segment-swift-package
Last synced: 24 days ago
JSON representation
Segment add-on integration for Smartlook SDK
- Host: GitHub
- URL: https://github.com/smartlook/segment-swift-package
- Owner: smartlook
- License: mit
- Created: 2022-09-22T09:24:35.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-21T13:46:43.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T23:54:54.932Z (9 months ago)
- Language: Swift
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SmartlookSegmentPlugin
This plugin allows you to easily add Smartlook support to your applications through [Analytics-Swift](https://github.com/segmentio/analytics-swift)
## Adding the dependency
To add this plugin to your project, you'll need to install the Smartlook library as an additional dependency. There are two ways to add the dependency:
### Via Xcode
1. Open Xcode and go to the File menu.
2. Click Add Packages.
3. In the search field, enter the URL to this repo: https://github.com/smartlook/segment-swift-package
4. 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.
5. Once you've made your selections, click the Add Package button.### via Package.swift
Add the following to your `Package.swift` file under the `dependencies` section:
```
.package(
name: "SmartlookSegmentPlugin",
url: "https://github.com/smartlook/segment-swift-package",
from: "1.0"
),
```*Note the Smartlook library itself will be installed as an additional dependency.*
## Using the Plugin in your App
1. Open the file where you setup and configure the Analytics-Swift library.
2. Import the plugin by adding this line at the top of the file:```
import Segment
import SmartlookSegmentPlugin
```3. Beneath your Analytics-Swift library setup, add the plugin to the Analytics timeline by invoking `analytics.add(plugin: ...)`, like this:
```
let analytics = Analytics(configuration: Configuration(writeKey: "")
.flushAt(1)
.trackApplicationLifecycleEvents(true))
analytics.add(plugin: SmartlookSegmentPlugin(projectKey: ""))
```Once you've added the plugin, your events will begin streaming to Smartlook.