Configure User Name Reporting

Application Performance Monitoring can provide reports on user names.

Application Administrators can configure Application Performance Monitoring to create reports on user names by following these steps:

  1. Identify the original source of the username. This depends on the monitored application and authentication mechanism used.

  2. Embed scripting in the application pages (or the application landing page). Assign the user name value to the apmeum.username variable. This makes the user name available for reporting.

For user names to be reported by APM they have to be made known to APM by setting the apmeum.usernamevariable. The original source of the username depends on the monitored application and authentication mechanism used. Below are a few examples of how username can be collected in different types of environments:

  1. Get the username from Windows in Internet Explorer:

    var WinNetwork = new ActiveXObject("WScript.Network");
    window.apmeum || (apmeum = {} );
    apmeum.username =  WinNetwork.UserName
    
  2. Get the username logic from PHP code:

    window.apmeum || (apmeum = {} );
    apmeum.username = '<?php echo $username; ?>';
    
  3. Get the username from the page:

    You can use this if the page is using DOM, and the page contains something like <div id="welcomeMsg">Welcome <user> (last visit <mm–dd-yyyy>)</div>.
    var Loginname = document.getElementById("welcomeMsg").innerHTML ;   
    var end = Loginname.indexOf("("); 
    var nameOnly = Loginname.substring(8, end);
    window.apmeum || (apmeum = {} );
    apmeum.username = nameOnly;
    
  4. Get the username from EBS username:

    You can extract username from your Oracle E-Business Suite (EBS) site.

    1. Log in to the EBS site, and navigate to a page where your log-in name is visible.

    2. Using an editor, view the source of this page. It is recommended that you use an editor that shows the source code without formatting or rendering.

    3. Search for your username in the code. Here are some examples of how you may see the username:

      Pattern 1:
      [...]
      <td width="100%">
      		<h1 class="x1f" type="OraHeader">
         Welcome <USER NAME>, <DATE>
        </h1>
      </td> 
      [...]
      Pattern 2:
      [...]
      <td class="x8g">
      		<span class="x2v">Logged In As </span>
      		<span class="x2u"><USER NAME> </span>
       </td> 
      [...]
    4. For the 2 patterns mentioned above, you can use the Javascript code shown below to extract user names. Add this snippet just before the end of the <body> section.

      
      <head>
      ...
      ...
      ...
      </head>
      <body>
      ...
      ...
      ...
      <script type='text/javascript' charset='UTF-8'>
        var namefromCookie = apmeum.util.getCookie('EBSUSERNAME');
        if (namefromCookie != null && namefromCookie.length > 0) {
          apmeum.username = namefromCookie;
        } else {
          var spanList1 = document.getElementsByClassName("x1f");
          var spanList2 = document.getElementsByClassName("x2u");
          if (spanList1 != null && spanList1.length > 0) {
            var loginName = spanList1[0].innerHTML;
            apmeum.username = loginName.replace('welcome ','');
          } else if (spanList2 != null && spanList2.length > 0) {
            var loginName = spanList2[0].innerHTML;
            apmeum.username = loginName;
          }
        }
      </script>
      </body>
      

Tip: Inspect the HTML page's session cookies — In Firefox, you can see this in the Tools menu, Web Developer option, Storage Inspector. Verify that a cookie containing the username is present. If the username is different from the EBSUSERNAME, use the observed name.