-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from lytics/intermediary/interface/0-main
Initial Implementation
- Loading branch information
Showing
67 changed files
with
37,095 additions
and
749 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,10 @@ | ||
nodeLinker: node-modules | ||
nmHoistingLimits: workspaces | ||
|
||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs | ||
spec: "@yarnpkg/plugin-interactive-tools" | ||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs | ||
spec: "@yarnpkg/plugin-workspace-tools" | ||
|
||
yarnPath: .yarn/releases/yarn-3.6.1.cjs |
This file contains 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 |
---|---|---|
|
@@ -2,4 +2,125 @@ | |
|
||
## Installation | ||
|
||
## Usage | ||
Install the SDK: | ||
|
||
```sh | ||
yarn add react-native-lytics | ||
``` | ||
|
||
### Android | ||
|
||
Add the following permissions to your `AndroidManifest.xml` file: | ||
|
||
```xml | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
``` | ||
|
||
This permission is required to send events to the Lytics API. | ||
|
||
```xml | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
``` | ||
|
||
This permission is technically optional but highly recommended to allow the library to determine the best time to send events to the API. | ||
|
||
### iOS | ||
|
||
Install native modules: | ||
|
||
```sh | ||
npx pod-install | ||
``` | ||
|
||
## Configuration | ||
|
||
You must initialize the Lytics SDK with your [API token](https://learn.lytics.com/documentation/product/features/account-management/managing-api-tokens) before using it. | ||
|
||
```jsx | ||
import { start } from 'react-native-lytics'; | ||
|
||
start({ | ||
apiToken: 'xxxxxx', | ||
... | ||
}); | ||
``` | ||
|
||
## Sending Data | ||
|
||
### Identity Events | ||
|
||
Tracking identity events provides an interface for updating the current user's properties stored on device as well as emitting an identify event to the downstream collections API. | ||
|
||
```jsx | ||
import { identify } from 'react-native-lytics'; | ||
|
||
identify({ identifiers: { email: '[email protected]' } }); | ||
``` | ||
|
||
### Consent Events | ||
|
||
Consent events provide an interface for configuring and emitting a special event that represents an app users explicit consent. This event does everything a normal event does in addition to providing a special payload for consent details at the discretion of the developer. | ||
|
||
```jsx | ||
import { consent } from 'react-native-lytics'; | ||
|
||
consent({ | ||
consent: { | ||
documents: ['terms_aug_2022', 'privacy_may_2022'], | ||
consented: true, | ||
}, | ||
}); | ||
``` | ||
|
||
### Track Custom Events | ||
|
||
Track custom events provides an interface for configuring and emitting a custom event at the customers discretion throughout their application (e.g. made a purchase or logged in). | ||
|
||
```jsx | ||
import { track } from 'react-native-lytics'; | ||
|
||
track({ name: 'Event_Tap', properties: { event: 'Event_Tap' } }); | ||
``` | ||
|
||
### Screen Events | ||
|
||
Screen events provide an interface for configuring and emitting a special event that represents a screen or page view. It should be seen as an extension of the track method. | ||
|
||
```jsx | ||
import { screen } from 'react-native-lytics'; | ||
|
||
screen({ | ||
name: 'Event_Detail', | ||
properties: { artistID: 123, eventID: 345 }, | ||
}); | ||
``` | ||
|
||
## Advertising ID | ||
|
||
### Android | ||
|
||
To support collecting the Android Advertising ID, add the following to the application's gradle dependencies: | ||
|
||
`implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'` | ||
|
||
Additionally, declare a Google Play services normal permission in the manifest file as follows: | ||
|
||
`<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>` | ||
|
||
After confirming with the user and getting their consent, enable Advertiser ID collection via `Lytics.enableGAID()`. | ||
|
||
The user's Android Advertising ID will be sent with each event's identifiers. | ||
|
||
Note, the user can disable or change the Advertising ID via the Android system privacy settings. | ||
|
||
### iOS | ||
|
||
Before collecting the IDFA you must first add a [`NSUserTrackingUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription) to your app's `Info.plist`. You can then call `requestTrackingAuthorization()` to have iOS request authorization to access the IDFA. Note that the alert will not be displayed if the user has turned off “Allow Apps to Request to Track” in the system privacy settings and that authorization can be revoked at any time. | ||
|
||
### Usage | ||
|
||
```jsx | ||
import { requestTrackingAuthorization } from 'react-native-lytics'; | ||
|
||
requestTrackingAuthorization(); | ||
``` |
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.sdk"> | ||
package="com.lytics.react_native"> | ||
</manifest> |
Oops, something went wrong.