Editing the Velocity Template to RUM-Enable Confluence

Velocity is a server-side template language used by Confluence to render page content. Velocity allows Java objects to be called alongside standard HTML.

To RUM-enable the Confluence pages, you should modify the velocity template, so that it includes the RUM code snippet. The template will then automatically inject the code snippet is every page it renders.

The detailed procedure for this is as follows:

  1. The first step is to copy the RUM script to be injected. For this, login to the eG administrative interface and add a Real User Monitor component using the Add/Modify page (Infrastructure -> Components -> Add/Modify).
  2. Once the component is added, the RUM script that should be included in the responses will be displayed. Copy this script to a text file. Note that this code snippet is case-sensitive. It is therefore recommended that you copy the code as is to the text file, instead of manually retyping it.

    Figure 1 : The RUM script that is to be injected into the HTTP responses

  1. Edit the <CONFLUENCE_INSTALL_DIR>\Atlassian\Confluence\confluence\decorators\includes\header.vm file.
  2. Insert the RUM code snippet in the text file to the header.vm file, after the meta tags, as indicated below:

    <!-- RUM Header --> <script charset='UTF-8 type='text/javascript'> window['egrum-start_time'] = new Date().getTime(); window['Site_Name'] = 'e75e3881-6e1e-4c47-9e47-8508ae5ed2c2-15714317681316'; window['beacon-url'] = 'https://192.168.8.26:7077'; </script> <script src='http://192.168.8.26:7077/rumcollector/egrum.js' async> </script> <!-- RUM Header -->

  3. Save the file.
  4. Next, proceed to flush all page caches. For this, first, login to Atlassian Confluence.
  5. When Figure 2 appears, click on the Confluence logo at the left, top corner of the window to view the toolbar. Then, click on the Gear icon on the toolbar and pick the General configuration option.

     

    Figure 2 : Selecting the General Configuration option

  1. When Figure 3 appears, click on the Cache Management option in the left panel.

    Figure 3 : Clicking on the Cache Management option

  1. Then, click on the Show advanced view option in the Cache Statistics page that appears in the right panel (see Figure 4).

    Figure 4 : Clicking on the Show advanced view link

  1. To flush the page caches, click the Flush links that correspond to all page-related caches (see Figure 5).

    Figure 5 : Flushing all page-related caches