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
Copy file name to clipboardExpand all lines: README.md
+19-3Lines changed: 19 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,11 @@ If your app has its own login system that you want to track users with, you can
44
44
amplitude.setUserId('USER_ID_HERE');
45
45
```
46
46
47
-
A user's data will be merged on the backend so that any events up to that point from the same browser will be tracked under the same user.
47
+
A user's data will be merged on the backend so that any events up to that point from the same browser will be tracked under the same user. Note: if a user logs out, or you want to log the events under an anonymous user, you may set the userId to `null` like so:
48
+
49
+
```javascript
50
+
amplitude.setUserId(null); // not string 'null'
51
+
```
48
52
49
53
You can also add the user ID as an argument to the `init` call:
The SDK supports the operations `set`, `setOnce`, `unset`, and `add` on individual user properties. The operations are declared via a provided `Identify` interface. Multiple operations can be chained together in a single `Identify` object. The `Identify` object is then passed to the Amplitude client to send to the server. The results of the operations will be visible immediately in the dashboard, and take effect for events logged after.
68
72
@@ -114,6 +118,18 @@ var identify = new amplitude.Identify()
114
118
amplitude.identify(identify);
115
119
```
116
120
121
+
### Arrays in User Properties ###
122
+
123
+
The SDK supports arrays in user properties. Anyof the user property operations above (with the exception of`add`) can accept a Javascript array. You can directly `set` arrays, or use `append` to generate an array.
You may use `setUserProperties` shorthand to set multiple user properties at once. This method is simply a wrapper around `Identify.set` and `identify`.
| savedMaxCount | Maximum number of events to save in localStorage. If more events are logged while offline, old events are removed. | 1000 |
177
193
| uploadBatchSize | Maximum number of events to send to the server per request. | 100 |
178
194
| includeUtm | If `true`, finds utm parameters in the query string or the __utmz cookie, parses, and includes them as user propeties on all events uploaded. |`false`|
179
-
| includeReferrer | If `true`, includes `referrer` and `referring_domain` as user propeties on all events uploaded. |`false`|
195
+
| includeReferrer | If `true`, captures the `referrer` and `referring_domain`for each session, as well as the user's `initial_referrer` and `initial_referring_domain` via a set once operation. |`false`|
180
196
| batchEvents | If `true`, events are batched together and uploaded only when the number of unsent events is greater than or equal to `eventUploadThreshold` or after `eventUploadPeriodMillis` milliseconds have passed since the first unsent event was logged. |`false`|
181
197
| eventUploadThreshold | Minimum number of events to batch together per request if `batchEvents` is `true`. | 30 |
182
198
| eventUploadPeriodMillis | Amount of time in milliseconds that the SDK waits before uploading events if `batchEvents` is `true`. | 30\*1000 (30 sec) |
0 commit comments