Syntax
newrelic_get_browser_timing_header([bool $include_tags])
Returns a browser monitoring snippet to inject in the head of your HTML output.
Description
Returns a JavaScript string to inject in the <head>
of your HTML output. Use this call with newrelic_get_browser_timing_footer
to manually add browser monitoring to a webpage. If possible, New Relic recommends instead enabling browser monitoring via the New Relic UI or copy/pasting the JavaScript snippet. For instructions on using these options, see browser monitoring and PHP.
Tip
Compare newrelic_disable_autorum
, which disables the browser script on a page.
Parameters
Parameter | Description |
---|---|
data type | Optional. Defaults to If |
Return values
Returns the browser agent's JavaScript header string.
Examples
Instrument a webpage
function example(){
if (extension_loaded('newrelic')) { // Ensure PHP agent is available
$newrelic_header = newrelic_get_browser_timing_header();
}
... // Output to page
if (extension_loaded('newrelic')) { // Ensure PHP agent is available
$newrelic_footer = newrelic_get_browser_timing_footer();
}
}
For more help
If you need more help, check out these support and learning resources:
- 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 and and documentation.