---
title: get_browser_timing_header (Python agent API)
source: https://docs.newrelic.com/docs/apm/agents/python-agent/python-agent-api/getbrowsertimingheader-python-agent-api
---

## Syntax [#syntax]

```py
get_browser_timing_header(nonce=None)
```

Generates a browser monitoring agent header for injecting the JavaScript agent.

## Description [#description]

> #### ⚠️ IMPORTANT
>
> The nonce parameter for nonced CSP support was added in Python agent version 9.4.0.
>
> In Python agent versions 9.3.0 and below, the [`get_browser_timing_footer`](https://docs.newrelic.com/docs/agents/python-agent/python-agent-api/get_browser_timing_footer) API was also required to enable browser timing. Starting with agent version 9.4.0 and later, this is no longer required.

This call returns the browser agent JavaScript header snippet that you can use to enable [browser monitoring](https://docs.newrelic.com/docs/agents/python-agent/supported-features/page-load-timing-python). You might use this if automatic instrumentation is not possible for your application, if you use a nonced content security policy, or if you want to collect browser data for only specific pages.

This is a manual alternative to [automatic insertion of this JavaScript](https://docs.newrelic.com/docs/browser/new-relic-browser/installation-configuration/add-apps-new-relic-browser#select-apm-app) by the agent.
To learn how to enable browser monitoring using this call along with `get_browser_timing_footer`, see [Manually instrument browser monitoring](https://docs.newrelic.com/docs/agents/python-agent/supported-features/page-load-timing-python#manual_instrumentation).

This call must be called for every web request where you want to inject the JavaScript snippet. It **cannot** be called at global scope and cached.

## Parameters [#parameters]

| Parameter        | Description                                                                                    |
| ---------------- | ---------------------------------------------------------------------------------------------- |
| `nonce` _string_ | Optional. The per-request, cryptographic nonce used by Content Security Policy (CSP) policies. |

## Return values [#return-values]

Returns the browser agent header JavaScript.

## Examples [#examples]

### Manual browser monitoring instrumentation [#browser-example]

See [Manually instrument browser monitoring](https://docs.newrelic.com/docs/agents/python-agent/supported-features/page-load-timing-python#manual_instrumentation) for instructions on how to use the header and footer calls.

### CSP Nonce example [#csp-nonce-example]

See [CSP Nonce support](https://docs.newrelic.com/docs/agents/python-agent/supported-features/page-load-timing-python#csp-nonce-support) for instructions on how to use the header calls with CSP nonces.
