browser-sdk

Home > @datadog/browser-rum > RumGlobal

RumGlobal interface

The RUM Browser SDK global object that provides all the public methods.

Signature:

export interface RumPublicApi extends PublicApi 

Extends: PublicApi

Properties

</tbody></table> ## Methods
Property Modifiers Type Description
addAction (name: string, context?: object) => void Add a custom action, stored in `@action`
addDurationVital (name: string, options: { startTime: number; duration: number; context?: object; description?: string; }) => void Add a custom duration vital
addError (error: unknown, context?: object) => void Add a custom error, stored in `@error`.
addFeatureFlagEvaluation (key: string, value: any) => void Add a feature flag evaluation, stored in `@feature_flags.` </td></tr>
addTiming (name: string, time?: number) => void Add a custom timing relative to the start of the current view, stored in `@view.custom_timings.` </td></tr>
clearAccount () => void Clear all account information
clearGlobalContext () => void Clear the global context See Global context for further information.
clearUser () => void Clear all user information See User session for further information.
getAccount () => Context Get account information
getGlobalContext () => Context Get the global Context See Global context for further information.
getInitConfiguration () => RumInitConfiguration | undefined Get the init configuration
getInternalContext (startTime?: number) => InternalContext | undefined [Internal API] Get the internal SDK context
getSessionReplayLink () => string | undefined Get the Session Replay Link. See Connect Session Replay To Your Third-Party Tools for further information.
getUser () => Context Get user information See User session for further information.
getViewContext () => Context Get View Context.
init (initConfiguration: RumInitConfiguration) => void Init the RUM browser SDK.
removeAccountProperty (key: string) => void Remove an account property
removeGlobalContextProperty (key: any) => void Remove a global context property See Global context for further information.
removeUserProperty (key: any) => void Remove a user property See User session for further information.
setAccount (newAccount: Account) => void Set account information to all events, stored in `@account`
setAccountProperty (key: string, property: any) => void Set or update the account property, stored in `@account.` </td></tr>
setGlobalContext (context: any) => void Set the global context information to all events, stored in `@context`
setGlobalContextProperty (key: any, value: any) => void Set or update a global context property, stored in `@context.` </td></tr>
setTrackingConsent (trackingConsent: TrackingConsent) => void Set the tracking consent of the current user.
setUserProperty (key: any, property: any) => void Set or update the user property, stored in `@usr.` </td></tr>
setViewContext (context: Context) => void Set View Context. Enable to manually set the context of the current view.
setViewContextProperty (key: string, value: any) => void Set View Context Property. Enable to manually set a property of the context of the current view.
setViewName (name: string) => void Set View Name. Enable to manually change the name of the current view.
startDurationVital (name: string, options?: { context?: object; description?: string; }) => DurationVitalReference Start a custom duration vital. If you plan to have multiple durations for the same vital, you should use the reference returned by this method.
startSessionReplayRecording (options?: StartRecordingOptions) => void Start Session Replay recording. Enable to conditionally start the recording, use the `startSessionReplayRecordingManually:true` init parameter and call `startSessionReplayRecording()` See Browser Session Replay for further information.
startView { (name?: string): void; (options: ViewOptions): void; } Start a view manually. Enable to manual start a view, use `trackViewsManually: true` init parameter and call `startView()` to create RUM views and be aligned with how you've defined them in your SPA application routing.
stopDurationVital (nameOrRef: string | DurationVitalReference, options?: { context?: object; description?: string; }) => void Stop a custom duration vital
stopSession () => void Stop the session. A new session will start at the next user interaction with the page.
stopSessionReplayRecording () => void Stop Session Replay recording. See Browser Session Replay for further information.
Method Description
setUser(newUser) Set user information to all events, stored in `@usr` See User session for further information.
setUser(newUser) Set user information to all events, stored in `@usr`