• /
  • ログイン
  • 無料アカウント

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.

ヒント

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.

ヒント

This API call requires updates to security allow lists. For more information about Content Security Policy (CSP) considerations, visit the browser monitoring compatibility and 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>
  ...

その他のヘルプ

さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:

問題を作成するこのページを編集する
Copyright © 2020 New Relic Inc.