Adding the JavaScript monitoring component to your application

To help you understand the performance of your web pages in a browser and any errors, the Response Time Monitoring agent needs to be able to collect timing data from the browser. To enable this feature, you must configure the application that you want to monitor.

About this task

Before you can monitor interactions within your web pages, you need to add the JavaScript monitoring component to each web page for your application. The JavaScript monitoring component captures the state of each web page and associated JavaScript interactions. Add the JavaScript monitoring component to the application that you want to monitor. The relevant content and actions are automatically captured and sent to the Cloud APM server for analysis and correlation.

Procedure

Complete the following steps to enable collection of real user monitoring data from the browser. These steps need to be completed only once, unless the application configuration changes.

  1. Add the JavaScript monitoring component to the application. The procedure that you use depends on the application type:
    1. For Java EE applications, extract install_dir/clienttime/ClientTime.war from the installation package to a directory accessible to the HTTP Server.
    2. For non-Java EE applications, such as Ruby, .NET, Python, and Node.js, save install_dir/clienttime/wrtInstrumentation.js from the installation package to a directory accessible to the HTTP Server.

      Extract the install_dir/clienttime/ClientTime.war file to a temporary path. You must copy the extracted wrtTimingTarget.dat file to the document root. Document root is a setting on the HTTP Server (Apache, IIS, and so on). It is a directory to store your documents. By default, all requests are taken from this directory but symbolic links and aliases might be used to point to other locations. For example, the document root for Apache is /opt/IBM/HTTPServer/htdocs.

      The wrtInstrumentation.js file can be placed in any directory. Ensure you update the path location to the wrtInstrumentation.js file in the HTML header.

  2. Associate the JavaScript monitoring component with the application.

    This association can normally be done by modifying an application header script. Typically, only one header script needs to be modified for each component or application that is to be monitored.

    For both Java EE applications and non-Java EE applications, add the following JavaScript to the application header before any other JavaScript:
    <script language="JavaScript" src="path/wrtInstrumentation.js" 
    type="text/JavaScript"></script>
    where path is the relative path to the JavaScript monitoring component
    For example:
    <script language="JavaScript" src="/ClientTime/wrtInstrumentation.js" 
    type="text/JavaScript"></script>

Results

Pages that are instrumented with the JavaScript monitoring component are monitored, and data from the pages is analyzed and displayed in End User Transactions dashboards.