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
Adding user information to your RUM sessions can help you:
332
332
* Follow the journey of a given user
@@ -345,7 +345,11 @@ The following attributes are optional but Datadog recommends providing at least
345
345
346
346
Increase your filtering capabilities by adding extra attributes on top of the recommended ones. For instance, add information about the user plan, or which user group they belong to.
347
347
348
-
To identify user sessions, use the `setUser` API:
348
+
When making changes to the user session object, all RUM events collected after the change contain the updated information.
Clear a previously set user with the `removeUser` API. All RUM events collected afterwards do not contain user information.
480
+
<div class="alert alert-info">The RUM Browser SDK v4.17.0 introduced `clearUser` and deprecated `removeUser`</div>
394
481
395
482
{{< tabs >}}
396
483
{{% tab "NPM" %}}
397
484
```
398
-
datadogRum.removeUser()
485
+
datadogRum.clearUser()
399
486
```
400
487
401
488
{{% /tab %}}
402
489
{{% tab "CDN async" %}}
403
490
```
404
491
DD_RUM.onReady(function() {
405
-
DD_RUM.removeUser()
492
+
DD_RUM.clearUser()
406
493
})
407
494
```
408
495
{{% /tab %}}
409
496
{{% tab "CDN sync" %}}
410
497
411
498
```
412
-
window.DD_RUM && window.DD_RUM.removeUser()
499
+
window.DD_RUM && window.DD_RUM.clearUser()
413
500
```
414
501
415
502
{{% /tab %}}
@@ -474,20 +561,22 @@ For a sampled out session, all page views and associated telemetry for that sess
474
561
475
562
## Global context
476
563
477
-
### Add global context
564
+
### Add global context property
478
565
479
-
Once RUM is initialized, add extra context to all RUM events collected from your application with the `addRumGlobalContext(key: string, value: any)` API:
566
+
After RUM is initialized, add extra context to all RUM events collected from your application with the `setGlobalContextProperty(key: string, value: any)` API:
567
+
568
+
<div class="alert alert-info">The RUM Browser SDK v4.17.0 introduced `setGlobalContextProperty` and deprecated `addRumGlobalContext`</div>
480
569
481
570
{{< tabs >}}
482
571
{{% tab "NPM" %}}
483
572
484
573
```
485
574
import { datadogRum } from '@datadog/browser-rum';
0 commit comments