Enabling the eG Real User Monitor to Capture User Names

The detailed diagnostics provided by the eG Real User Monitor reveal the exact URLs in the target web site/web application that are slow to respond to user requests. By default however, these detailed metrics do not report the names of the users who hit the slow URLs.

If you want the detailed diagnostics to report the user names as well, then first, make sure that the following pre-requisites are fulfilled:

  • In order for the eG RUM script to capture user name for every page view, the user name DOM field/element must be present in each page of the target web site. If the DOM of any web page (in the web site) does not contain the user name, then eG RUM will not be able to capture the user name for that web page.

  • The user name can be available as a hidden field element in DOM or a field which is displayed/visible in the user interface. Regardless, for eG RUM to capture the user name, it must be loaded and available in DOM once the page is loaded fully. To check if the user name is 'available' in a web page or not, do the following:

    • Wait for the page to be loaded fully.

    • Right-click on the page, and pick the View Page Source option from the quick menu that pops out.

    • Next, search the source for the 'username' of interest to you - say, john. If you are able to find that 'username' in the source, you can conclude that eG RUM can capture it and display it as part of detailed diagnostics.

Once the aforesaid requirements are in place, follow the steps below to configure eG RUM, so it can capture the user name:

  1. From a browser, connect to the eG management console.

  2. Login to the console as user admin with password admin.

  3. Using the eG admin interface that opens, manage the web site you want to monitor as a Real User Monitor component.

  4. While at it, set the Capture UserName flag to Yes, so that the name of the users who initiated the slow requests is displayed as part of the detailed diagnostics.

  5. Next, select an option from the Expression Type list to indicate how you want the user name captured . The available options are as follows:

    • CSS Selector: In CSS (Cascading Style Sheet), selectors are patterns used to select an element in an HTML page. If the name of the user is displayed in the slow web page, then you can capture that user name using the CSS Selector that points to it. To achieve this, select the CSS Selector option from the Expression Type list. Upon selecting this Expression Type, eG will prompt you to specify the following:

      Figure 1 : Capturing user name using CSS Selector

      • In the CSS Selector Name text box (see Figure 1), specify which CSS Selector points to the user name. To identify the CSS Selector, do the following:

        1. Open the slow web page in a browser.

        2. Right-click on the user name in that web page and choose Inspect from the shortcut menu that appears.

          Figure 2 : Selecting the Inspect option from the right-click menu of the user name

        3. This will invoke Developer Tools, where you can view the source code of that web page with the code block governing the user name display highlighted.

          Figure 3 : Inspecting the chosen user name code block in Developer Tools

        4. In the code block, right-click on the element representing the user name, swipe your mouse over Copy, and select Copy selector to copy the selector of the chosen element. In the process, the CSS Selector of the user name will get copied automatically.

          Figure 4 : Copying the CSS Selector

        5. Finally, paste the copied selector in the CSS Selector Name text box in Figure 1.

      • Next, mention the CSS Selector Index. By default, this index is set to 1. You may have to change the index if the web page displays multiple user names, but only one of those user names needs to be captured into the detailed diagnosis. For instance, a web page can display the name of the current login user and that of the user who logged in previously. Each of these user names will be governed by the same CSS Selector, but their index will vary. In this case, against CSS Selector Index, you will have to specify the index number of that user name that is of interest to you.

    • DOM Locator: The Document Object Model (DOM), in simple terms, is the way by which HTML elements are structured. Using a DOM Locator, you can access elements in an HTML page. If you want to use a DOM Locator to capture the user name displayed in a slow web page, then set DOM Locator as the Expression Type. If this option is chosen, you will have to specify the following:

      Figure 5 : Capturing user name using DOM locator

      • In the DOM Locator Name text box, specify the name of the DOM Locator using which the user name in the web page can be accessed. To know which DOM Locator to use for this, do the following:

        1. Open the slow web page in a browser.

        2. Right-click on the user name in that web page and choose Inspect from the shortcut menu that appears (see Figure 2).

        3. This will invoke Developer Tools, where you can view the source code of that web page with the code block governing the user name display highlighted (see Figure 3).

        4. In the code block, the value of the 'id' attribute of the user name is the DOM Locator. Copy the value of this attribute and paste it against DOM Locator Name (see Figure 5).

      • Next, mention the DOM Locator Index. By default, this index is set to 1. You may have to change the index if the web page displays multiple user names, but only one of those user names needs to be captured into the detailed diagnosis. For instance, a web page can display the name of the current login user and that of the user who logged in previously. Each of these user names will be governed by the same DOM Locator, but their index will vary. In this case, against DOM Locator Index, you will have to specify the index number of that user name that is of interest to you (see Figure 5).

    • XPath Locator: XPath is designed to allow the navigation of XML documents, with the purpose of selecting individual elements, attributes, or some other part of an XML document for specific processing. XPath is used to find the location of any element on a web page using HTML DOM structure. If you want to use the XPath Locator to capture user names from slow web pages, then set Expression Type as XPath Locator. Then, specify the following:

      Figure 6 : Capturing user name using XPath locator

      • In the XPath Locator Name text box, specify the name of the XPath Locator to use for capturing the user name. To know how to identify the XPath Locator for the user name element in a web page, do the following:

        1. Open the slow web page in a browser.

        2. Right-click on the user name in that web page and choose Inspect from the shortcut menu that appears (see Figure 2).

        3. This will invoke Developer Tools, where you can view the source code of that web page with the code block governing the user name display highlighted (see Figure 3).

        4. In the code block, right-click on the element representing the user name, swipe your mouse over Copy, and select Copy XPath to copy the XPath of the chosen element (see Figure 4).

        5. Finally, paste the copied XPath against XPath Locator Name (see Figure 6).

    • Next, mention the XPath Locator Index. By default, this index is set to 1. You may have to change the index if the web page displays multiple user names, but only one of those user names needs to be captured into the detailed diagnosis. For instance, a web page can display the name of the current login user and that of the user who logged in previously. Each of these user names will be governed by the same XPath Locator, but their index will vary. In this case, against XPath Locator Index, you will have to specify the index number of that user name that is of interest to you.

  6. After defining how you want to capture the user name, indicate whether/not you want to trim or cleanup the user name so captured. For instance, the user name captured may include the first name, middle name, and last name of the user. However, in the detailed diagnosis you may want to display the first name of the user only, or the first and last names alone. Likewise, a user name displayed in the web page may be prefixed by titles such as Mr. or Ms. You may want to trim these titles out when including the user name in the detailed diagnosis. In such cases, set the Apply Cleanup Rule flag to Yes (see Figure 1). If the user name can be included in detailed diagnosis as is - i.e., without any trimming or cleanup - then set this flag to No.

  7. If the Apply Cleanup Rule flag is set to Yes, then you will have to provide the Extraction Rule. This rule will be automatically applied to every user name captured, so that it is 'trimmed' or 'cleansed' of unnecessary frills and readied for inclusion in detailed diagnosis. For instance, say that a user name displayed in a web page is prefixed by the salutation, 'Hi'. When such a user name is captured using a selector or locator, the 'Hi' is captured with it. Naturally, you will want to remove the 'Hi' and add just the 'user name' to the detailed diagnosis. For this, your Extraction Rule will be of the format: Hi (.*) (see Figure 5).

This way, you can ensure that user name information is captured and included in detailed diagnosis. With the help of this information, help desk can quickly identify the users who are experiencing slowness, well before they actually complain.

Moreover, using the same procedure discussed above, you can include any custom information you find useful in detailed diagnosis. For instance, if a shopping web site is being monitored, then you can build some business context into your detailed statistics by including the name of the customers who experienced slowness, the name/ID of the product that was being sold over a slow transaction, the total order value of the transaction, etc. Such information will enable business managers to easily analyze the business impact of transaction slowness. In other words, using this information, business heads can figure out who (customers) and what (product ranges) were impacted by the poor performance of the web-based services, and how badly.