You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Navigate to the ios directory of the project via terminal and run `pod install`
26
25
27
26
### Android React Native 0.59 or below
27
+
28
28
#### Automatically
29
+
29
30
`react-native link`
30
31
31
32
#### Manually
32
-
1. Append the following lines to `android/settings.gradle`:
33
-
33
+
34
+
1. Append the following lines to `android/settings.gradle`:
35
+
34
36
`include ':sift-react-native'`
35
-
37
+
36
38
`project(':sift-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/sift-react-native/android')`
37
-
38
-
2. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
39
-
39
+
40
+
2. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
41
+
40
42
implementation project(':sift-react-native')
41
-
42
-
3. Open up `android/app/src/main/java/[...]/MainApplication.java`
43
-
44
43
45
-
- Add `import com.siftreactnative.SiftReactNativePackage;` to the imports at the top of the file
46
-
- Add `new SiftReactNativePackage()` to the list returned by the `getPackages()` method. Add a comma to the previous item if there's already something there.
44
+
3. Open up `android/app/src/main/java/[...]/MainApplication.java`
45
+
46
+
- Add `import com.siftreactnative.SiftReactNativePackage;` to the imports at the top of the file
47
+
- Add `new SiftReactNativePackage()` to the list returned by the `getPackages()` method. Add a comma to the previous item if there's already something there.
47
48
49
+
Insert the following lines inside the dependencies block in
50
+
`android/app/build.gradle`:
48
51
49
-
Insert the following lines inside the dependencies block in
-**accountId** (string, the Account ID that needs to be obtained from Sift console under [API Keys](https://console.sift.com/developer/api-keys) tab) **_required_**
69
82
-**beaconKey** (string, the Beacon Key that needs to be obtained from Sift console under [API Keys](https://console.sift.com/developer/api-keys) tab) **_required_**
70
83
-**disallowCollectingLocationData** (boolean, permission to allow collection of location data from device)
71
-
> _Make sure to add location permissions to your application if you want Sift to collect location data.
72
-
Sift will not request permissions that are not granted by the user from your application._
84
+
> _Make sure to add location permissions to your application if you want Sift to collect location data.
85
+
> Sift will not request permissions that are not granted by the user from your application._
73
86
-**serverUrlFormat** (string, the format of URL where the data needs to be uploaded)
74
-
-- Sample URL format for iOS: `https://api3.siftscience.com/v3/accounts/%@/mobile_events`
75
-
-- Sample URL format for Android: `https://api3.siftscience.com/v3/accounts/%s/mobile_events`
76
-
> **_NB: This feature is available only in iOS platform_**
87
+
-- Sample URL format for iOS: `https://api3.siftscience.com/v3/accounts/%@/mobile_events`
88
+
-- Sample URL format for Android: `https://api3.siftscience.com/v3/accounts/%s/mobile_events`
89
+
> **_NB: This feature is available only in iOS platform_**
90
+
77
91
#### Set the User ID
92
+
78
93
As soon as your application is aware of the user id, set it on the Sift instance using the code below. All subsequent events will include the user id.
94
+
79
95
```js
80
96
SiftReactNative.setUserId(userId);
81
97
```
98
+
82
99
If the user logs out of your application, you should unset the user id:
83
-
```js
100
+
101
+
```js
84
102
SiftReactNative.unsetUserId();
85
103
```
86
-
#### Upload event
104
+
105
+
#### Upload event
106
+
87
107
To upload collected events to sift.
108
+
88
109
```js
89
110
SiftReactNative.upload();
90
111
```
91
-
#### Set page name
92
-
>**_NB: This feature is available only in Android platform_**
112
+
113
+
#### Set page name
114
+
115
+
> **_NB: This feature is available only in Android platform_**
93
116
94
117
To set the page name
118
+
95
119
```js
96
-
SiftReactNative.setPageName("HomePage");
120
+
SiftReactNative.setPageName('HomePage');
97
121
```
122
+
98
123
## Example
99
124
100
125
To see `sift-react-native` in action you can check out the source in the `example` folder.
@@ -104,6 +129,7 @@ To see `sift-react-native` in action you can check out the source in the `exampl
104
129
yarn bootstrap
105
130
106
131
When the bootstrap is done, you will be able to start the example app by executing one of the following commands:
132
+
107
133
### iOS app
108
134
109
135
yarn example ios
@@ -115,4 +141,3 @@ When the bootstrap is done, you will be able to start the example app by executi
0 commit comments