Custom APIs in Real User Monitor serve various functions, such as
setting dynamic values for user IDs, capturing JavaScript (JS) errors, specifying session timeout, and more. They enhance user session tracking in Real User Monitor, providing a more comprehensive view of user activity. For a complete list of supported custom APIs in Real User Monitor, please
refer to the documentation.
In Real User Monitor, a unique user ID is generated by the RUM Script whenever a user makes a transaction. This ID is used to identify the session and the list of transactions associated with it. To facilitate debugging of user-specific issues, the Capture User Name API can be utilized to assign a username to the user ID. This enables more accurate identification of the user and their activity.
This article provides guidance on utilizing the Capture User Name API to capture usernames in Real User Monitor.
Syntax of Capture User Name API :
apmr('userName',"user@test.com"); Step 1
- To capture usernames in Real User Monitor, you must first identify where the username is stored within your application.
- The location of the username may vary depending on the application, and could be found in various places such as the text of a DOM element, a JavaScript variable, cookies, query strings, server-side request attributes, meta-tags, and more.
Step 2
- Write a script to extract the username from your application, as identified in Step 1.
- Sample script to get username from DOM.
var userName = document.querySelector("#name").innerText;
- Note that the script will need to be customized based on the unique characteristics of your application.
Check with the application developer to create a script to capture username from the application.
Step 3
- Invoke the Capture User Name API using the username retrieved by the script.
var userName = document.querySelector("#name").innerText;
apmr('userName', userName);
For instance, in Applications Manager, the username will be displayed on clicking the profile icon. By utilizing a CSS selector, we can identify the location of the element in the DOM, and then generate a script to extract the username from the DOM.
Capture username API allows only 250 characters in the username and below special characters will be removed if present in the username.
`~!@#$^&_|+=?;'",<>(){}[]
Custom APIs are supported only from Applications Manager version 16400 and RUM Agent version 3.2.