|
39 | 39 |
|
40 | 40 | **● ready**: *`false`* = false
|
41 | 41 |
|
42 |
| -*Defined in [analytics.ts:96](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L96)* |
43 |
| - |
44 |
| -Whether the client is ready to send events to Segment. |
45 |
| - |
46 |
| -This becomes `true` when `.setup()` succeeds. All calls will be queued until it becomes `true`. |
| 42 | +*Defined in analytics.ts:96* |
47 | 43 |
|
48 | 44 | ___
|
49 | 45 |
|
|
55 | 51 |
|
56 | 52 | ▸ **alias**(newId: *`string`*, options?: *[Options]()*): `Promise`<`void`>
|
57 | 53 |
|
58 |
| -*Defined in [analytics.ts:266](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L266)* |
59 |
| - |
60 |
| -Merge two user identities, effectively connecting two sets of user data as one. This may not be supported by all integrations. |
61 |
| - |
62 |
| -When you learn more about who the group is, you can record that information with group. |
| 54 | +*Defined in analytics.ts:266* |
63 | 55 |
|
64 | 56 | **Parameters:**
|
65 | 57 |
|
|
77 | 69 |
|
78 | 70 | ▸ **catch**(handler: *[ErrorHandler]()*): `this`
|
79 | 71 |
|
80 |
| -*Defined in [analytics.ts:111](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L111)* |
81 |
| - |
82 |
| -Catch React-Native bridge errors |
83 |
| - |
84 |
| -These errors are emitted when calling the native counterpart. This only applies to methods with no return value (`Promise<void>`), methods like `getAnonymousId` do reject promises. |
| 72 | +*Defined in analytics.ts:111* |
85 | 73 |
|
86 | 74 | **Parameters:**
|
87 | 75 |
|
|
98 | 86 |
|
99 | 87 | ▸ **disable**(): `Promise`<`void`>
|
100 | 88 |
|
101 |
| -*Defined in [analytics.ts:305](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L305)* |
102 |
| - |
103 |
| -Completely disable the sending of any analytics data. |
104 |
| - |
105 |
| -If you have a way for users to actively or passively (sometimes based on location) opt-out of analytics data collection, you can use this method to turn off all data collection. |
| 89 | +*Defined in analytics.ts:305* |
106 | 90 |
|
107 | 91 | **Returns:** `Promise`<`void`>
|
108 | 92 |
|
|
113 | 97 |
|
114 | 98 | ▸ **enable**(): `Promise`<`void`>
|
115 | 99 |
|
116 |
| -*Defined in [analytics.ts:295](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L295)* |
117 |
| - |
118 |
| -Enable the sending of analytics data. Enabled by default. |
119 |
| - |
120 |
| -Occasionally used in conjunction with disable user opt-out handling. |
| 100 | +*Defined in analytics.ts:295* |
121 | 101 |
|
122 | 102 | **Returns:** `Promise`<`void`>
|
123 | 103 |
|
|
128 | 108 |
|
129 | 109 | ▸ **flush**(): `Promise`<`void`>
|
130 | 110 |
|
131 |
| -*Defined in [analytics.ts:286](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L286)* |
132 |
| - |
133 |
| -Trigger an upload of all queued events. |
134 |
| - |
135 |
| -This is useful when you want to force all messages queued on the device to be uploaded. Please note that not all integrations respond to this method. |
| 111 | +*Defined in analytics.ts:286* |
136 | 112 |
|
137 | 113 | **Returns:** `Promise`<`void`>
|
138 | 114 |
|
|
143 | 119 |
|
144 | 120 | ▸ **getAnonymousId**(): `Promise`<`string`>
|
145 | 121 |
|
146 |
| -*Defined in [analytics.ts:310](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L310)* |
147 |
| - |
148 |
| -Retrieve the anonymousId. |
| 122 | +*Defined in analytics.ts:310* |
149 | 123 |
|
150 | 124 | **Returns:** `Promise`<`string`>
|
151 | 125 |
|
|
156 | 130 |
|
157 | 131 | ▸ **group**(groupId: *`string`*, traits?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
|
158 | 132 |
|
159 |
| -*Defined in [analytics.ts:253](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L253)* |
160 |
| - |
161 |
| -Associate a user with a group, organization, company, project, or w/e _you_ call them. |
162 |
| - |
163 |
| -When you learn more about who the group is, you can record that information with group. |
| 133 | +*Defined in analytics.ts:253* |
164 | 134 |
|
165 | 135 | **Parameters:**
|
166 | 136 |
|
|
179 | 149 |
|
180 | 150 | ▸ **identify**(user: *`string`*, traits?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
|
181 | 151 |
|
182 |
| -*Defined in [analytics.ts:240](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L240)* |
183 |
| - |
184 |
| -Associate a user with their unique ID and record traits about them. |
185 |
| - |
186 |
| -When you learn more about who your user is, you can record that information with identify. |
| 152 | +*Defined in analytics.ts:240* |
187 | 153 |
|
188 | 154 | **Parameters:**
|
189 | 155 |
|
|
202 | 168 |
|
203 | 169 | ▸ **middleware**(middleware: *[Middleware]()*): `this`
|
204 | 170 |
|
205 |
| -*Defined in [analytics.ts:149](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L149)* |
206 |
| - |
207 |
| -Append a new middleware to the middleware chain. |
208 |
| - |
209 |
| -Middlewares are a powerful mechanism that can augment the events collected by the SDK. A middleware is a simple function that is invoked by the Segment SDK and can be used to monitor, modify or reject events. |
210 |
| - |
211 |
| -Middlewares are invoked for all events, including automatically tracked events, and external event sources like Adjust and Optimizely. This offers you the ability the customize those messages to fit your use case even if the event was sent outside your source code. |
212 |
| - |
213 |
| -The key thing to observe here is that the output produced by the first middleware feeds into the second. This allows you to chain and compose independent middlewares! |
214 |
| - |
215 |
| -For example, you might want to record the device year class with your events. Previously, you would have to do this everywhere you trigger an event with the Segment SDK. With middlewares, you can do this in a single place : |
216 |
| - |
217 |
| -```js |
218 |
| -import DeviceYearClass from 'react-native-device-year-class' |
219 |
| - |
220 |
| -analytics.middleware(async ({next, context}) => |
221 |
| - next({ |
222 |
| - ...context, |
223 |
| - device_year_class: await DeviceYearClass() |
224 |
| - }) |
225 |
| -) |
226 |
| -``` |
| 171 | +*Defined in analytics.ts:149* |
227 | 172 |
|
228 | 173 | **Parameters:**
|
229 | 174 |
|
|
240 | 185 |
|
241 | 186 | ▸ **reset**(): `Promise`<`void`>
|
242 | 187 |
|
243 |
| -*Defined in [analytics.ts:276](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L276)* |
244 |
| - |
245 |
| -Reset any user state that is cached on the device. |
246 |
| - |
247 |
| -This is useful when a user logs out and you want to clear the identity. It will clear any traits or userId's cached on the device. |
| 188 | +*Defined in analytics.ts:276* |
248 | 189 |
|
249 | 190 | **Returns:** `Promise`<`void`>
|
250 | 191 |
|
|
255 | 196 |
|
256 | 197 | ▸ **screen**(name: *`string`*, properties?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
|
257 | 198 |
|
258 |
| -*Defined in [analytics.ts:225](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L225)* |
259 |
| - |
260 |
| -Record the screens or views your users see. |
261 |
| - |
262 |
| -When a user views a screen in your app, you'll want to record that here. For some tools like Google Analytics and Flurry, screen views are treated specially, and are different from "events" kind of like "page views" on the web. For services that don't treat "screen views" specially, we map "screen" straight to "track" with the same parameters. For example, Mixpanel doesn't treat "screen views" any differently. So a call to "screen" will be tracked as a normal event in Mixpanel, but get sent to Google Analytics and Flurry as a "screen". |
| 199 | +*Defined in analytics.ts:225* |
263 | 200 |
|
264 | 201 | **Parameters:**
|
265 | 202 |
|
|
278 | 215 |
|
279 | 216 | ▸ **setup**(writeKey: *`string`*, configuration?: *[Configuration](../interfaces/analytics.configuration.md)*): `Promise`<`void`>
|
280 | 217 |
|
281 |
| -*Defined in [analytics.ts:188](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L188)* |
282 |
| - |
283 |
| -Setup the Analytics module. All calls made before are queued and only executed if the configuration was successful. |
284 |
| - |
285 |
| -```js |
286 |
| -await analytics.setup('YOUR_WRITE_KEY', { |
287 |
| - using: [Mixpanel, GoogleAnalytics], |
288 |
| - trackAppLifecycleEvents: true, |
289 |
| - ios: { |
290 |
| - trackDeepLinks: true |
291 |
| - } |
292 |
| -}) |
293 |
| -``` |
| 218 | +*Defined in analytics.ts:188* |
294 | 219 |
|
295 | 220 | **Parameters:**
|
296 | 221 |
|
|
308 | 233 |
|
309 | 234 | ▸ **track**(event: *`string`*, properties?: *[JsonMap]()*, options?: *[Options]()*): `Promise`<`void`>
|
310 | 235 |
|
311 |
| -*Defined in [analytics.ts:207](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L207)* |
312 |
| - |
313 |
| -Record the actions your users perform. |
314 |
| - |
315 |
| -When a user performs an action in your app, you'll want to track that action for later analysis. Use the event name to say what the user did, and properties to specify any interesting details of the action. |
| 236 | +*Defined in analytics.ts:207* |
316 | 237 |
|
317 | 238 | **Parameters:**
|
318 | 239 |
|
|
331 | 252 |
|
332 | 253 | ▸ **useNativeConfiguration**(): `this`
|
333 | 254 |
|
334 |
| -*Defined in [analytics.ts:161](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L161)* |
335 |
| - |
336 |
| -Use the native configuration. |
337 |
| - |
338 |
| -You'll need to call this method when you configure Analytics's singleton using the native API. |
| 255 | +*Defined in analytics.ts:161* |
339 | 256 |
|
340 | 257 | **Returns:** `this`
|
341 | 258 |
|
|
0 commit comments