newrelic_get_browser_timing_header

newrelic_get_browser_timing_header([bool $include_tags])
Returns a New Relic Browser 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 New Relic Browser monitoring to a webpage. If possible, New Relic recommends instead enabling Browser via the New Relic UI or copy/pasting the JavaScript snippet. For instructions on using these options, see Page load timing in PHP.

Compare newrelic_disable_autorum, which disables the Browser script on a page.

Parameters

Parameter Description

$include_tags

data type

Optional. Defaults to true.

If true or omitted, the JavaScript string is enclosed in a <script> element for easy inclusion into the page's HTML.

Return value(s)

Returns New Relic Browser agent's JavaScript header string.

Example(s)

Instrument a webpage

function example(){
    if (extension_loaded('newrelic')) { // Ensure PHP agent is available
        newrelic_get_browser_timing_header();
    }
    ... // Output to page
    if (extension_loaded('newrelic')) { // Ensure PHP agent is available
        newrelic_get_browser_timing_footer();
    }
}