How to capture username in Real User Monitor using Custom API?

How to capture username in Real User Monitor using Custom API?

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
  1. To capture usernames in Real User Monitor, you must first identify where the username is stored within your application.
  2. 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
  1. Write a script to extract the username from your application, as identified in Step 1. 
  2. Sample script to get username from DOM.
var userName = document.querySelector("#name").innerText;                                                                    
  1. 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
  1. 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.

                  New to ADSelfService Plus?

                    • Related Articles

                    • Real User Monitor (RUM) - Troubleshooting

                      If the monitor has not polled data for a long time, follow the steps below for troubleshooting: Step 1: Check prerequisites to be done Real User Monitor requires the RUM Agent to be installed and mapped to the Applications Manager. Refer the help ...
                    • Self monitor Applications Manager using Real User Monitoring

                      We can monitor the Applications Manager using Real User Monitoring with a Java Script injection and this can be used to measure the Applications Manager's performance continuously. All you need is to install and setup the Real User Monitoring (RUM) ...
                    • How to get ISP and Region data in Real User Monitor?

                      The default setting of the Real User Monitor does not display ISP and region data for the end user. To obtain the data, you have the option to use a third-party Geolocation API. Currently, RUM exclusively supports APIs that provide responses in JSON ...
                    • Real User Monitoring Agent - Frequently asked questions

                      How to change Applications Manager details in RUM Agent? Open the AppServer.properties file located under <RUMAgent_Home>/conf/ directory in any text editor. Update Applications Manager hostname in apm.host key. Update Applications Manager SSL Port ...
                    • REST API Monitor - FAQS

                      1. What should I do when Basic Authentication fails in REST API monitor? Verify if the credentials provided in the Applications Manager are correct. Try if sending username and password in Authorization request header works Get an BASE-64 encoded ...