Clear all account information
Clear all account information
Get account information
Remove an account property
Key of the property to remove
Set account information to all events, stored in @account
Set or update the account property, stored in @account.<key>
Key of the property
Value of the property
Add a custom action, stored in @action
See Send RUM Custom Actions for further information.
Name of the action
Optional
context: objectContext of the action
Add a custom error, stored in @error
.
See Send RUM Custom Actions for further information.
Error. Favor sending a Javascript Error to have a stack trace attached to the error event.
Optional
context: objectContext of the error
Add a custom timing relative to the start of the current view,
stored in @view.custom_timings.<timing_name>
Note: passing a relative time is discouraged since it is actually used as-is but displayed relative to the view start. We currently don't provide a way to retrieve the view start time, so it can be challenging to provide a timing relative to the view start. see https://github.com/DataDog/browser-sdk/issues/2552
Name of the custom timing
Optional
time: numberEpoch timestamp of the custom timing (if not set, will use current time)
Get the global Context
See Global context for further information.
Remove a global context property
See Global context for further information.
Set the global context information to all events, stored in @context
See Global context for further information.
Set or update a global context property, stored in @context.<key>
See Global context for further information.
Key of the property
Value of the property
Clear the global context
See Global context for further information.
Get the init configuration
Init the RUM browser SDK.
See RUM Browser Monitoring Setup for further information.
Configuration options of the SDK
datadogRum.init({
applicationId: '<DATADOG_APPLICATION_ID>',
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
// service: 'my-web-application',
// env: 'production',
// version: '1.0.0',
sessionSampleRate: 100,
sessionReplaySampleRate: 100,
trackResources: true,
trackLongTasks: true,
trackUserInteractions: true,
})
Add a feature flag evaluation,
stored in @feature_flags.<feature_flag_key>
We recommend enabling the intake request compression when using feature flags compressIntakeRequests: true
.
See Feature Flag Tracking for further information.
The key of the feature flag.
The value of the feature flag.
For CDN async setup: Early RUM API calls must be wrapped in the window.DD_RUM.onReady()
callback. This ensures the code only gets executed once the SDK is properly loaded.
See CDN async setup for further information.
Version of the Logs browser SDK
Stop the session. A new session will start at the next user interaction with the page.
Get the Session Replay Link.
See Connect Session Replay To Your Third-Party Tools for further information.
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.
Stop Session Replay recording.
See Browser Session Replay for further information.
Set the tracking consent of the current user.
Data will be sent only if it is set to "granted". This value won't be stored by the library
across page loads: you will need to call this method or set the appropriate trackingConsent
field in the init() method at each page load.
If this method is called before the init() method, the provided value will take precedence over the one provided as initialization parameter.
See User tracking consent for further information.
The user tracking consent
Clear all user information
See User session for further information.
Get user information
See User session for further information.
Remove a user property
Key of the property to remove
User session for further information.
Set or update the user property, stored in @usr.<key>
See User session for further information.
Key of the property
Value of the property
Set user information to all events, stored in @usr
See User session for further information.
User information
Set View Context.
Enable to manually set the context of the current view.
Set View Context Property.
Enable to manually set a property of the context of the current view.
key of the property
value of the property
Set View Name.
Enable to manually change the name of the current view. See Override default RUM view names for further information.
Name of the view
Get View Context.
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.
See Override default RUM view names for further information.
Optional
nameOrOptions: string | ViewOptionsName or options (name, service, version) for the view
Add a custom duration vital
Name of the custom vital
Options for the custom vital (startTime, duration, context, description)
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.
Name of the custom vital
Optional
options: DurationVitalOptionsOptions for the custom vital (context, description)
reference to the custom vital
Stop a custom duration vital
Name or reference of the custom vital
Optional
options: DurationVitalOptionsOptions for the custom vital (context, description)
Public API for the RUM browser SDK.
See RUM Browser Monitoring Setup for further information.