Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smartlook/segment-react-native-plugin-smartlook
Segment react-native destination plugin for Smartlook.
https://github.com/smartlook/segment-react-native-plugin-smartlook
Last synced: about 1 month ago
JSON representation
Segment react-native destination plugin for Smartlook.
- Host: GitHub
- URL: https://github.com/smartlook/segment-react-native-plugin-smartlook
- Owner: smartlook
- License: mit
- Created: 2022-06-23T14:09:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-04T21:52:06.000Z (about 2 years ago)
- Last Synced: 2024-11-18T22:39:48.934Z (2 months ago)
- Language: TypeScript
- Size: 287 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @smartlook/segment-react-native-plugin-smartlook
`DestinationPlugin` for [Smartlook](https://smartlook.com/). Wraps the [`react-native-smartlook-analytics`](https://www.npmjs.com/package/react-native-smartlook-analytics) package.
## Installation
You need to install the `@smartlook/segment-react-native-plugin-smartlook` and the `react-native-smartlook-analytics` dependency.
Using NPM:
```bash
npm install --save @smartlook/segment-react-native-plugin-smartlook react-native-smartlook-analytics
```Using Yarn:
```bash
yarn add @smartlook/segment-react-native-plugin-smartlook react-native-smartlook-analytics
```Run `pod install` after the installation to autolink the Smartlook SDK.
Follow the [React Native Smartlook SDK Installation](https://mobile.developer.smartlook.com/reference/react-native-sdk-installation) guide to finish the setup of react-native-smartlook-analytics in your app.
See [@segment/analytics-react-native](https://github.com/segmentio/analytics-react-native) for a detailed guide about adding the Segment Analytics to your app.## Usage
Follow the [instructions for adding plugins](https://github.com/segmentio/analytics-react-native#adding-plugins) on the main Analytics client:
In your code where you initialize the analytics client call the `.add(plugin)` method with a new `SmartlookPlugin` instance.
```ts
import { createClient } from '@segment/analytics-react-native';
import { SmartlookPlugin } from '@smartlook/segment-react-native-plugin-smartlook';
import Smartlook from 'react-native-smartlook-analytics';const segmentClient = createClient({
writeKey: 'SEGMENT_KEY'
});Smartlook.instance.preferences.setProjectKey(
'SMARTLOOK_KEY'
);segmentClient.add({ plugin: new SmartlookPlugin() });
```