Disable RUM JavaScript injection based on client

According to the documentation, it is possible to enable or disable the Javascript that is used to implement RUM, either globally or on a specific pages.

We have a situation where we need to disable it for a particular user agent. We have an automated system that hits our web pages to validate that they work, but these pages views are skewing our metrics. We are not interested in the performance of this automated system, and need to have some way to prevent it from recording browser data in New Relic.

Right now it seems that our only option is to manually inject the New Relic javascript into our JSP pages, but this is a huge amount of work. Is there an easier way to prevent the RUM JavaScript from being injected based on attributes like the user agent of the client?

Hi @matthew.casperson - there may be a way for you to do this if there are specific headers for your specific user agent. It would be case of injecting some javascript in the of the page to check and load the New Relic script if the agent is not your agent. I haven’t tried this but something similar to:

<script type="text/javascript">
  if(navigator.userAgent != [your agent])
  // load NR browser script
1 Like