Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Feature Idea: PHP Browser Auto Instrumentation should have an option to load as an external script



newrelic.browser_monitoring.auto_instrument is a very useful feature, except it is missing a setting to load its header and footer scripts through external scripts automatically.


newrelic.browser_monitoring.auto_instrument_url = string. (e.g. /__newrelic__/ ends up with /__newrelic__/header, /__newrelic__/footer are used for both parts of initialization)

Proposed is a new setting, that when set, will cause the given route to be handled by the NewRelic php extension, and instead of inserting inline javascript, load external scripts for the header and footer.


  • NewRelic extension in inserting 24kb of javascript on every single page load. None of which changes, bloating output unnecessarily on every single page instead of having a cache-able instrumentation, and more importantly, webRequest blockable runtime.
  • The script inserted by NewRelic is incompatible with Cypress, which, because it is an inline script, very hard to avoid. If it was external scripts, you could simply route the given setting to an empty file from the cypress tests and avoid errors caused by incompatibilities of Cypress’s monkey-patched XMLHttpRequest object and NewRelic’s instrumentation code.
  • Manual instrumentation is significantly more annoying to do when your web application does not necessarily have shared controller logic on each page (which is why automatic instrumentation is wanted).
  • It is less than ideal to have to manually disable auto instrumentation for NewRelic by needing to watch for magic flags in the URL, especially with non-uniform view controllers.

I get that you want to have “best performance” of your page instrumentation by inlining the code, but it fails to be a “small script”, and worse, makes headaches when trying to run tests against production. Give us the option to load the inline scripts as external scripts (both insertion into the page for header/footer handled by automatic instrumentation and output of the specified url controlled by your extension). You can feel free to note that this might cause metrics to become skewed, but you’re already skewing metrics with the amount of code you already insert instead of sending a max-age=86400 cache controlled external script instead.

Literally can make all my headaches go away with your extension if I could just webRequest block your code away for my tests.

New Relic Edit

  • I want this too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.



It is so good to get so much detail here for us to file this as a request up to the agents team. I’m going to file it more generally under Browser, since this is a great request for all agents to have.

Thanks for posting here :smiley: