• /
  • Log in
  • Free account

GetBrowserTimingHeader (.NET agent API)

Syntax

NewRelic.Api.Agent.NewRelic.GetBrowserTimingHeader()
NewRelic.Api.Agent.NewRelic.GetBrowserTimingHeader(string nonce)

Generate a Browser monitoring HTML snippet to instrument end-user browsers.

Requirements

Compatible with all agent versions.

Must be called inside a transaction.

Description

Returns an HTML snippet used to enable Browser monitoring. The snippet instructs the browser to fetch a small JavaScript file and start the page timer. You can then insert the returned snippet into the header of your HTML webpages. For more information, see Adding apps to Browser monitoring.

Tip

Compare DisableBrowserMonitoring(), which disables the Browser script on a page.

Parameters

Parameter

Description

nonce

string

The per-request, cryptographic nonce used by Content-Security-Policy policies.

Tip

This API call requires updates to security allow lists. For more information about Content Security Policy (CSP) considerations, visit the Browser Monitoring Compatibility Requirements page.

Return values

An HTML string to be embedded in a page header.

Examples

With ASPX

<html>
  <head>
    <%= NewRelic.Api.Agent.NewRelic.GetBrowserTimingHeader()%>
    ...
  </head>
  <body>
  ...
<html>
  <head>
    <%= NewRelic.Api.Agent.NewRelic.GetBrowserTimingHeader("YOUR_NONCE_VALUE")%>
    ...
  </head>
  <body>
  ...

With Razor

<!DOCTYPE html>
<html lang="en">
  <head>
    @Html.Raw(NewRelic.Api.Agent.NewRelic.GetBrowserTimingHeader())
    ...
  </head>
  <body>
  ...
<!DOCTYPE html>
<html lang="en">
  <head>
    @Html.Raw(NewRelic.Api.Agent.NewRelic.GetBrowserTimingHeader("YOUR_NONCE_VALUE"))
    ...
  </head>
  <body>
  ...

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.