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
{{ message }}
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: packages/core/docs/classes/analytics.client.md
+52-34Lines changed: 52 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@
22
22
*[flush](analytics.client.md#flush)
23
23
*[group](analytics.client.md#group)
24
24
*[identify](analytics.client.md#identify)
25
+
*[middleware](analytics.client.md#middleware)
25
26
*[reset](analytics.client.md#reset)
26
27
*[screen](analytics.client.md#screen)
27
28
*[track](analytics.client.md#track)
@@ -36,7 +37,7 @@
36
37
37
38
**● ready**: *`false`* = false
38
39
39
-
*Defined in [analytics.ts:13](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L13)*
40
+
*Defined in [analytics.ts:14](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L14)*
40
41
41
42
Whether the client is ready to send events to Segment.
42
43
@@ -50,9 +51,9 @@ ___
50
51
51
52
### alias
52
53
53
-
▸ **alias**(newId: *`string`*): `this`
54
+
▸ **alias**(newId: *`string`*): `Promise`<`void`>
54
55
55
-
*Defined in [analytics.ts:115](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L115)*
56
+
*Defined in [analytics.ts:125](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L125)*
56
57
57
58
Merge two user identities, effectively connecting two sets of user data as one. This may not be supported by all integrations.
58
59
@@ -64,7 +65,7 @@ When you learn more about who the group is, you can record that information with
64
65
| ------ | ------ | ------ |
65
66
| newId |`string`| The new ID you want to alias the existing ID to. The existing ID will be either the previousId if you have called identify, or the anonymous ID. |
66
67
67
-
**Returns:**`this`
68
+
**Returns:**`Promise`<`void`>
68
69
69
70
___
70
71
<aid="catch"></a>
@@ -73,7 +74,7 @@ ___
73
74
74
75
▸ **catch**(handler: *[ErrorHandler]()*): `this`
75
76
76
-
*Defined in [analytics.ts:23](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L23)*
77
+
*Defined in [analytics.ts:27](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L27)*
*Defined in [analytics.ts:43](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L43)*
98
+
*Defined in [analytics.ts:53](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L53)*
98
99
99
100
Configure the Analytics module.
100
101
@@ -117,54 +118,54 @@ ___
117
118
118
119
### disable
119
120
120
-
▸ **disable**(): `this`
121
+
▸ **disable**(): `Promise`<`void`>
121
122
122
-
*Defined in [analytics.ts:154](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L154)*
123
+
*Defined in [analytics.ts:164](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L164)*
123
124
124
125
Completely disable the sending of any analytics data.
125
126
126
127
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.
127
128
128
-
**Returns:**`this`
129
+
**Returns:**`Promise`<`void`>
129
130
130
131
___
131
132
<aid="enable"></a>
132
133
133
134
### enable
134
135
135
-
▸ **enable**(): `this`
136
+
▸ **enable**(): `Promise`<`void`>
136
137
137
-
*Defined in [analytics.ts:144](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L144)*
138
+
*Defined in [analytics.ts:154](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L154)*
138
139
139
140
Enable the sending of analytics data. Enabled by default.
140
141
141
142
Occasionally used in conjunction with disable user opt-out handling.
142
143
143
-
**Returns:**`this`
144
+
**Returns:**`Promise`<`void`>
144
145
145
146
___
146
147
<aid="flush"></a>
147
148
148
149
### flush
149
150
150
-
▸ **flush**(): `this`
151
+
▸ **flush**(): `Promise`<`void`>
151
152
152
-
*Defined in [analytics.ts:135](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L135)*
153
+
*Defined in [analytics.ts:145](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L145)*
153
154
154
155
Trigger an upload of all queued events.
155
156
156
157
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.
*Defined in [analytics.ts:90](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L90)*
190
+
*Defined in [analytics.ts:100](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L100)*
190
191
191
192
Associate a user with their unique ID and record traits about them.
192
193
@@ -196,8 +197,25 @@ When you learn more about who your user is, you can record that information with
196
197
197
198
| Param | Type | Default value | Description |
198
199
| ------ | ------ | ------ | ------ |
199
-
| userId |`string`| - | database ID (or email address) for this user. If you don't have a userId but want to record traits, you should pass nil. For more information on how we generate the UUID and Apple's policies on IDs, see [https://segment.io/libraries/ios#ids](https://segment.io/libraries/ios#ids)|
200
-
|`Default value` traits |[JsonMap]()| {} | A dictionary of traits you know about the user. Things like: email, name, plan, etc. |
200
+
| user |`string`| - | database ID (or email address) for this user. If you don't have a userId but want to record traits, you should pass nil. For more information on how we generate the UUID and Apple's policies on IDs, see [https://segment.io/libraries/ios#ids](https://segment.io/libraries/ios#ids)|
201
+
|`Default value` traits |`JsonMap`| {} | A dictionary of traits you know about the user. Things like: email, name, plan, etc. |
*Defined in [analytics.ts:76](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L76)*
244
+
*Defined in [analytics.ts:86](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L86)*
227
245
228
246
Record the screens or views your users see.
229
247
@@ -234,18 +252,18 @@ When a user views a screen in your app, you'll want to record that here. For som
234
252
| Param | Type | Default value | Description |
235
253
| ------ | ------ | ------ | ------ |
236
254
| name |`string`| - | The title of the screen being viewed. We recommend using human-readable names like 'Photo Feed' or 'Completed Purchase Screen'. |
237
-
|`Default value` properties |[JsonMap]()| {} | A dictionary of properties for the screen view event. If the event was 'Added to Shopping Cart', it might have properties like price, productType, etc. |
255
+
|`Default value` properties |`JsonMap`| {} | A dictionary of properties for the screen view event. If the event was 'Added to Shopping Cart', it might have properties like price, productType, etc. |
*Defined in [analytics.ts:58](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L58)*
266
+
*Defined in [analytics.ts:68](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L68)*
249
267
250
268
Record the actions your users perform.
251
269
@@ -256,9 +274,9 @@ When a user performs an action in your app, you'll want to track that action for
256
274
| Param | Type | Default value | Description |
257
275
| ------ | ------ | ------ | ------ |
258
276
| event |`string`| - | The name of the event you're tracking. We recommend using human-readable names like \`Played a Song\` or \`Updated Status\`. |
259
-
|`Default value` properties |[JsonMap]()| {} | A dictionary of properties for the event. If the event was 'Added to Shopping Cart', it might have properties like price, productType, etc. |
277
+
|`Default value` properties |`JsonMap`| {} | A dictionary of properties for the event. If the event was 'Added to Shopping Cart', it might have properties like price, productType, etc. |
*Inherited from [Base](analytics.chainedconfiguration.base.md).[android](analytics.chainedconfiguration.base.md#android)*
31
32
32
-
*Defined in [analytics.ts:193](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L193)*
33
+
*Defined in [analytics.ts:203](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L203)*
33
34
34
35
Access Android specific settings
35
36
@@ -42,7 +43,7 @@ ___
42
43
43
44
▸ **disableDeviceId**(): `this`
44
45
45
-
*Defined in [analytics.ts:247](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L247)*
46
+
*Defined in [analytics.ts:257](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L257)*
46
47
47
48
Disable the collection of the device identifier. Enabled by default.
48
49
@@ -54,6 +55,25 @@ The device identifier is obtained using :
54
55
55
56
**Returns:**`this`
56
57
58
+
___
59
+
<aid="flushinterval"></a>
60
+
61
+
### flushInterval
62
+
63
+
▸ **flushInterval**(every: *`number`*): `this`
64
+
65
+
*Defined in [analytics.ts:264](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L264)*
66
+
67
+
Set the interval at which the client should flush events. The client will automatically flush events to Segment every [flushInterval](analytics.chainedconfiguration.android.md#flushinterval) duration, regardless of [flushAt](analytics.chainedconfiguration.configuration.md#flushat).
68
+
69
+
**Parameters:**
70
+
71
+
| Param | Type | Description |
72
+
| ------ | ------ | ------ |
73
+
| every |`number`| the interval in milliseconds |
74
+
75
+
**Returns:**`this`
76
+
57
77
___
58
78
<aid="ios"></a>
59
79
@@ -63,7 +83,7 @@ ___
63
83
64
84
*Inherited from [Base](analytics.chainedconfiguration.base.md).[ios](analytics.chainedconfiguration.base.md#ios)*
65
85
66
-
*Defined in [analytics.ts:189](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L189)*
86
+
*Defined in [analytics.ts:199](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L199)*
67
87
68
88
Access iOS specific settings
69
89
@@ -78,7 +98,7 @@ ___
78
98
79
99
*Inherited from [Base](analytics.chainedconfiguration.base.md).[setup](analytics.chainedconfiguration.base.md#setup)*
80
100
81
-
*Defined in [analytics.ts:185](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L185)*
101
+
*Defined in [analytics.ts:195](https://github.com/segmentio/analytics-react-native/blob/master/packages/core/src/analytics.ts#L195)*
82
102
83
103
Finalize the configuration and initialize the Analytics client.
0 commit comments