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 eG administrative interface.

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

  4. When configuring the Website test for that component, you will find the Enable UserName Tagging For PageViews parameter (see Figure 1). Set this parameter to Enabled, and click the icon alongside.

    Figure 1 : Enabling Username tagging for pageviews

  5. Figure 2 will then appear.

    Figure 2 : Configuring user name tagging

  6. 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 3 : Capturing user name using CSS Selector

      • In the CSS Selector Name text box (see ) (see Figure 3, 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.

          Selecting Inspect Option from Right-click Menu of User Name

          Figure 4 : 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.

          Inspecting Chosen User Name Code Block in Developer Tools

          Figure 5 : 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.

          Copying CSS Selector

          Figure 6 : Copying the CSS Selector

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

      • 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 7 : 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 4).

        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 5).

        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 ).

      • 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 7).

    • 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:

      Capturing User Name Using XPath Locator

      Figure 8 : Capturing user name using XPath locator

      Figure 9 :  

      • 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 4).

        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 5).

        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 6).

        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.

    • JavaScript Variable: If the target application exposes user names using a JavaScript variable, then you can configure eG RUM to capture user names by reading that variable's value. Make sure that the variable name you use for this purpose fulfills the following conditions:

      • Ideally, the variable name should be globally accessible - i.e., it should be accessible across all pages of the web site. If not, then detailed diagnostics will display user name for only those URLs in which this variable is accessible.

      • The variable you use should be set as a 'window' object in the JavaScript - e.g., window.location, window.username etc.

      Then, follow the steps below to configure eG RUM to use that variable name for capturing user names:

      • First, select JavaScript Variable as the Expression Type.

        Figure 10 : Capturing user name using a JavaScript Variable

      • Then, enter the JavaScript Variable Name from which the user name should be captured. For instance, if window.username is the JavaScript object that captures usernames, then specify username as the JavaScript Variable name. Sometimes, an object name can have multiple levels - e.g., window.region_asia.username. In this case, you will have to set region_asia.username as the variable name.

    • Meta Tag: The <meta> tag defines metadata about an HTML document. Metadata is data (information) about data.<meta> tags always go inside the <head> element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings. Occasionally, this <meta> tag is also used to set username, so that this information is available throughout the web page. In such a case, you can configure eG RUM to read the user name from the <meta> tag of the HTML pages. For this, do the following:

      • First, select Meta Tag as the Expression Type.

        Figure 11 : Capturing user name using the Meta Tag

      • Then, enter the Meta Tag Name from which the user name should be gleaned. For instance, take the case of the HTML code snippet below:

        Figure 12 : Meta tag definition in a sample HTML code snippet

        As can be inferred from the code block indicated in Figure 14, a <meta> tag definition typically contains a 'name' and 'content'. While the 'name' represents the meta tag name, 'content' is the value of that meta tag. If you want the 'value' of the meta tag to be displayed in the detailed diagnostics, then set the 'name' as the Meta Tag Name in Figure 13. In the case of the sample code snippet above, username should be set as the Meta Tag Name.

      • A Meta Tag name is not always unique. On occasion, there can be two or more meta tags with the same name, but referencing different values. In this case, use the Meta Tag Index parameter to indicate which <meta> tag's value should be read. By default, 1 is set as the Meta Tag Index. This means that eG RUM, by default, displays the value of the first occurrence of the given Meta Tag Name, in detailed diagnosis. You can change the value of this parameter, if you deem fit.

    • Cookie Value: A cookie (also known as a web cookie or browser cookie) is a small piece of data a server sends to a user's web browser. Typically, the server will use the contents of HTTP cookies to determine whether different requests come from the same browser/user and then issue a personalized or generic response as appropriate. Since cookies store user name information, you can configure eG RUM to retrieve user names from a cookie and report the same as part of detailed diagnostics. For this, do the following:

      • First, select Cookie Value as the Expression Type.

        Figure 13 : Capturing user name using Cookie value

      • Then, against Cookie Name, enter the name of the cookie from which the user name should be gleaned. To determine the cookie name, do the following:

        1. In a browser, open the target web page, right-click on it, and pick the Inspect option.

        2. This will open the DevTools console. Click on the Applications tab page in the console (see Figure 16).

          Figure 14 : Applications tab page in DevTools console

        3. Figure 16 will list the cookies in the target web page. Cookies are typically stored as Name:Value pairs, with the Name representing the 'cookie name' and Value denoting the 'value of the cookie'. Browse the list in Figure 16 for the cookie that stores user name values. For instance, in Figure 16 above, egusername is the Name of the cookie that returns 'user name' as its Value. In this case therefore, you need to specify egusername against Cookie Name in Figure 15.

          Note:

          • HTTP-only cookies cannot be accessed by eG RUM. Therefore, do not configure such cookies for user name extraction by eG RUM.

          • If user has chosen to reject cookies, then the browser will not capture any. In such a case, user name capturing through cookies will not work.

  7. Sometimes, an extraction rule may find more than one match in a web page. For instance, a single web page may display 'HiJohnny' first and then display the string 'HiUser'. If the Regex Extraction Rule is set as Hi(.*?), then eG RUM will find two strings that match the rule. The username to be extracted however is contained within the first string - 'HiJohnny' - only. Therefore, you need to instruct eG RUM to apply the extraction rule on the first match alone, and ignore the second match. You can do this using the Regex Extraction Rule Index for Username parameter. By default, this parameter is set to 1. This indicates that the rule will be applied and extraction performed on the first match only, by default. Based on your need, you can override this default setting by changing the value of this parameter.

  8. User Name Capture Over RUM Via BTM: User names can be captured using the eG Business Transaction Monitor as well. So, where both eG RUM and BTM are implemented, you have the flexibility to choose how you want the user name captured - using RUM? or using BTM? By default, the User Name Capture Over RUM Via BTM flag is set to No. This implies tha, by default, if eG BTM has been instrumented to capture user name, then only that user name will be included in the detailed diagnosis of the eG RUM tests. However, in the event that eG BTM is unavailable or is not configured to capture user names, then the user name captured by eG RUM will be included in detailed diagnosis. On the other hand, if you want to use only the user names that eG RUM reports, and ignore the user names output by eG BTM, then set this flag to Yes.

This way, you can ensure that user name information is captured and included in detailed diagnosis. With t 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.