With the PHP agent, you can add browser monitoring to your pages either automatically or manually. To enable browser monitoring in the user interface, follow the procedures to install the browser agent. Then follow the procedures in this section to set up the PHP agent.
To use browser monitoring with your PHP agent, ensure you have the latest release. For more information, see the agent installation instructions.
To configure the agent to automatically instrument pages with the browser monitoring script, add or edit the auto-instrumentation flag in your INI file. The PHP agent will automatically inject the browser monitoring's JS snippet into your pages.
Auto-instrumentation does not work when the HTTP header field
Calls to the PHP agent API are conditional on the
For more information, see:
This document does not provide detailed procedures to manually insert the Browser agent via the agent API. This is because there too many possible ways to construct a framework.
The manual instrumentation examples show how to add instrumentation to frameworks that already support auto-instrumentation. If you are using another framework or modified versions of Drupal or WordPress, be sure to call the API functions for instrumentation at the right place.
- Insert the return value of
newrelic_get_browser_timing_header()as part of the output page's
<head>tag, preferably as the very first thing.
- As the very last thing before the closing
</body>tag in the document, or as close to it as possible, insert the return value of
Here are some basic examples.
For how to disable browser monitoring with the PHP agent config, see Browser monitoring config option.
For how to use the API to disable browser monitoring, see
If you need more help, check out these support and learning resources:
- Suggest a change and learn how to contribute to our PHP agent open source repository.
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.