Sets the name of the currently active action, or the action corresponding to the provided ID.
The new name for the action.
OptionalactionId: numberThe ID of the action to update. If omitted, the currently active action is updated.
An ActionNameResult indicating whether the update was successful.
Attaches a listener that is called while entering an action.
Remove the listener if not needed, or filter actions using addActionProperties to prevent sending the
same action property for every action. Use this method to hook into the automatic action creation event to
influence related concepts such as action naming or action properties.
The callback function to be triggered when an action is entered.
The ID of the action being entered.
The start time of the action.
Indicates if the action is a root action.
Optionalelement: string | EventTargetThe element that initiated the event.
Attaches a listener that is called when leaving an action.
Remove the listener if not needed, or filter actions using addActionProperties to prevent sending the
same action property for every action. Use this method to hook into the out-of-the-box action closing event.
The callback function to be triggered when an action is left.
The ID of the action being left.
The end time of the action.
Indicates if the action is a root action.
Indicates the start of a user input. Every user input must be concluded by calling endUserInput. RUM JavaScript checks for an active user input when an XHR call or a page load occurs. If a user input is active, that input is marked as having triggered the user action. Use this method when a user input is not automatically detected by RUM JavaScript.
The DOM node (or a string identifier) that triggered the action (e.g., a button). Determines the caption for the resulting action.
The type of action (e.g., 'click', 'keypress', 'scroll').
OptionaladdInfo: stringOptional additional information about the user input (e.g., key, mouse button, etc.).
OptionalvalidTime: numberThe duration (in milliseconds) for which this user input should remain valid.
An object containing information about the user input.
Ends a user input that was started with beginUserInput.
The user input object returned by beginUserInput.
Enters a new custom action. Use this method to create a custom action.
This method must be called before leaveAction, which closes the custom action.
The name of the action.
OptionalactionType: stringDEPRECATED: This parameter is not used anymore and has no effect if provided.
OptionalstartTime: numberThe timestamp in milliseconds. If falsy, the current time is used.
OptionalsourceUrl: stringThe source URL for the action.
The ID of the created action, or 0 if the action was not created.
Extends or initiates actions. Use this method when you want to extend an active Load or XHR action with an unlinked XHR call, i.e., an action. It is particularly useful when the XHR call is asynchronous and cannot be automatically correlated with an action, which might otherwise cause the action to close prematurely, leading to inaccurate metrics (such as user action duration). This method must be called before leaveXhrAction.
Optional information about the type of XHR (e.g., framework name).
Optionalxmode: 0 | 1 | 3XHR action creation mode:
0 ... Extend only running XHR actions.
1 ... Extend any running action.
3 ... Start an action if a user input is present.
OptionalxhrUrl: stringThe URL of the requested resource. This argument should always be provided. If omitted, the request will appear as "/undefined" in the waterfall.
The ID of the XHR action.
Indicates that an XHR callback is active (e.g., XMLHttpRequest onreadystatechange) and links subsequently triggered XHR actions to this callback. For example, if an XHR callback adds a script tag to your page and triggers another XHR call, that call would not automatically be added to the current action. Calling this method allows the subsequent XHR call to be linked to its initial action. The XHR callback must be concluded with leaveXhrCallback.
The ID of the action to which the callback belongs.
Instructs RUM JavaScript to wait for an additional call to signalOnLoadEnd before closing the 'onload' action. Note: The load action will only use the provided load end event correctly if signalOnLoadEnd is called afterward.
Leaves an action that was previously created using enterAction. Use this method to set the load end event for a custom action and complete its creation. This method must be called after enterAction.
The ID of the action to leave. This must be the value returned by enterAction.
OptionalstopTime: numberThe timestamp in milliseconds. Providing a stop time will force the action to stop and prevent the visually complete module from extending it.
OptionalstartTime: numberOptional start time in milliseconds (necessary if the start time should be modified). Note that the start time must not be more than an hour in the past; otherwise it is ignored.
Indicates the end of an XHR action.
The ID of the XHR action.
OptionalstopTime: numberThe stop time of the XHR action in milliseconds.
Indicates the end of an XHR callback.
The ID of the action to which the callback belongs.
Removes a previously attached listener that detects the enter action event.
The reference to the listener to be removed.
Removes a previously attached listener that detects the leave action event.
The callback function to be removed.
The ID of the action being left.
The end time of the action.
Indicates if the action is a root action.
Enables or disables automatic action detection. Use this method when you want to manually instrument your application.
Specifies whether automatic action detection should be enabled or disabled.
Prevents RUM JavaScript from automatically detecting the load end event. The load end event must be explicitly set using signalLoadEnd. Call this method immediately after injecting RUM JavaScript.
Signals that the page has finished loading. Use in combination with setLoadEndManually to define your own load end times.
Indicates the end of a load action. This method requires that incrementOnLoadEndMarkers has been called beforehand. The action is closed after the final call to signalOnLoadEnd.
Indicates the start of a load action. Frameworks often have their own load callback functions, and this method can be used when a framework begins loading before the 'DOMContentLoaded' event.
Adds custom action properties
to the currently active action.
Only accepts valid java long, java double (as a string representation), Date objects, and short strings with a
maximum length of 100-1000 characters (as configured under Application Settings).
Action properties must be defined under Application settings and use a lowercase key.
The ID of the action.
OptionaljavaLong: PropertyMap<number>A JSON object containing key-value pairs of valid numbers. The values must be within the range -9223372036854776000 to 9223372036854776000.
Optionaldate: PropertyMap<Date>A JSON object containing key-value pairs of JavaScript Date objects.
OptionalshortString: PropertyMap<string>A JSON object containing key-value pairs of strings. Each string must be less than 100 characters.
OptionaljavaDouble: PropertyMap<number>A JSON object containing key-value pairs of valid floating point numbers. The values must be within the range -1.7976931348623157e+308 to 1.7976931348623157e+308.
A status report about the properties passed to the function. This report contains information about any failed properties with the reason for failure, as well as details of properties that were sent successfully, and a summary message regarding the total number of failed properties.
Re-enables automatic page detection after manual detection was enabled via enableManualPageDetection. Once this method is called, RUM JavaScript will resume automatically detecting page and page group names.
Enables manual page detection. Once this method is called, RUM JavaScript will stop automatically detecting page and page group names and will only use the values provided via setPage. It is recommended to call this as early as possible. To resume automatic detection, call enableAutomaticPageDetection.
Retrieves and evaluates metadata for the page, which can be used for troubleshooting RUM monitoring.
An array of metadata objects, each containing an id, type, expression, the captured value, and an optional failure reason.
Sets the user tag, which is used to identify individual users across different browsers, devices, and sessions.
The username. This can be a name, user ID, or email address.
Reports the HTTP status code and a custom message for the response of the current page. For example, use this method to mark your 404 pages that respond with an HTTP status code of 200. This method must be called before the page's onload event finishes; otherwise, the information will be discarded.
The HTTP status code to set.
An additional informational message.
Returns false if the values were incorrect or the method was called too late; otherwise, returns true.
Reports the HTTP status code and an additional message for the response of the current XHR action. For example, use this method when the HTTP status code of your XHR response is 200, but the server's result indicates a failed request. This method must be called before the XHR action finishes and all listeners have been invoked.
The HTTP status code of the current XHR action.
An additional informational message.
OptionalparentActionId: numberThe optional ID of the action to mark as failed. If not provided, the currently open action is used.
Returns false if the values were incorrect or the method was called too late; otherwise, returns true.
Reports custom errors to Dynatrace. Use this method to capture custom errors, such as form validation errors, that are defined in Application settings.
The key of the error (e.g., 'validation error').
The error value (e.g., 'Email validation failed').
Optionalhint: stringAn optional hint to identify the issue, such as the content of the input element that triggered the error.
OptionalparentingInfo: number | booleanDefines how the custom error should be attached. When a number is provided, the error is attached to the specified open action. When a boolean is provided and true, it is attached to the currently active action.
Reports an error to Dynatrace. Use this method when you catch errors in your application code and want to propagate them to Dynatrace, rather than handling them solely with your own logging. If the error is managed by your application, it will not be handled by the global JavaScript onerror event handler, which Dynatrace uses to automatically capture JavaScript errors.
The error to report. Any standard browser error object is supported. If the error does not include a stack trace, the RUM JavaScript monitoring code will attempt to generate one. Alternatively, you can provide your own object with the following properties: 'message', 'file', 'line', 'column', and 'stack'. The 'message' property is required; all other properties are optional.
OptionalparentActionId: numberThe parent action ID. If not provided or null, the error is added to the current action.
Sends session properties on a beacon
currently only accepts valid java long, java double (as a string representation), Date objects, and short strings of
a maximum length of 100-1000 characters (as configured under Application Settings).
NOTE: session properties need to have a lower case key!
Make sure to first define session properties under Application settings before making this API call.
OptionaljavaLongOrObject: PropertyObject | PropertyMap<number>A JSON object containing key-value pairs of valid numbers. The values must be within the range -9223372036854776000 to 9223372036854776000.
Optionaldate: PropertyMap<Date>A JSON object containing key-value pairs of JavaScript Date objects.
OptionalshortString: PropertyMap<string>A JSON object containing key-value pairs of strings. Each string must be less than 100 characters.
OptionaljavaDouble: PropertyMap<number>A JSON object containing key-value pairs of valid floating point numbers. The values must be within the range -1.7976931348623157e+308 to 1.7976931348623157e+308.
A status report about the properties passed to the function. This report contains information about any failed properties with the reason for failure, as well as details of properties that were sent successfully, and a summary message regarding the total number of failed properties.
addActionProperties is related and works similarly.
Starts a new page view and reports it to the Dynatrace server.
Optionalgroup?: stringThe group of the new view, recommended to include dynamic placeholders of the view name. For example, if the view name is "/books/123", the view group should be "books/:bookId" or similar. If null or undefined, the Dynatrace server calculates the group based on the name.
The name of the new view, typically matching the location.pathname or location.hash.
A negative number if starting the new page failed, or a positive number if the new page was started successfully.
Adds a listener that is called when the user is leaving the page, before the RUM monitoring beacon is sent. Use this method to hook into the page unload event.
A function that will be called in case the user leaves the page.
A boolean that is true if the page is currently being dismissed.
Adds a listener that is triggered when the current visit times out and before a new visit ID is generated.
The listener function to add, which receives the current visit ID and a boolean indicating if a new visit will start due to timeout.
The timed out visit ID.
True if a new visit will start due to timeout.
Disables RUM JavaScript and removes all cookies if it was previously enabled with enable, thereby activating the opt-in mode. Use this method along with a user consent tool to disable RUM monitoring when consent is not provided.
Removes all persistent values and disables any functionality that would recreate them. Note that this must be
called on every page, as it erases persistent RUM monitoring data, including the information that prevents
persistent data from being stored.
Use this method when you want to disable monitoring of returning users.
For more information, see cookie storage.
If true, the configuration state is saved in local storage so that it persists across page loads.
Disables session replay.
Enables RUM JavaScript if it was previously disabled via the opt-in mode. Use this method in conjunction with a user consent tool to enable RUM monitoring once consent has been provided.
Re-enables persistent values if they were previously disabled by calling disablePersistentValues. Use this method when you want to resume monitoring returning users.
Enables session replay.
If true, enables session replay regardless of the cost control configuration.
Immediately ends the current session.
Forces the sending of a beacon to ensure actions are not lost. For example, use this method before a window unload event by adding a addPageLeavingListener.
DEPRECATED: This parameter is not used anymore and has no effect if provided.
Forces the sending of preview beacons containing actions that have not yet been closed.
Terminates unfinished actions and sends them immediately. Handle with care, as actions might be inaccurate.