---
title: Optional manual browser instrumentation with Django templates
source: https://docs.newrelic.com/docs/apm/agents/python-agent/supported-features/optional-manual-browser-instrumentation-django-templates
---

The Python agent can automatically add browser monitoring to any HTML page responses. For most popular Python web frameworks, including Django, Flask, and Pyramid, use [automatic browser instrumentation](https://docs.newrelic.com/docs/agents/python-agent/supported-features/page-load-timing-python).

If you need to use manual instrumentation with Django templates, you can manually register and use the `newrelic_tags` tag library.

## Add Django template tags [#django_template_tags]

Follow this procedure **only** if you need to use manual instrumentation to insert the browser monitoring agent instead of the Python agent's [automatic instrumentation](https://docs.newrelic.com/docs/agents/python-agent/supported-features/page-load-timing-python).

To make this template tag library available, you must [manually add `newrelic.extras.framework_django`](https://docs.newrelic.com/docs/release-notes/agent-release-notes/python-release-notes/python-agent-110192) to the list of `INSTALLED_APPS` in your Django project settings files.

1.  At the top of the template file, add a reference to the tag library to the list of tag libraries being loaded by the load macro.

    ```django
    {% load ... newrelic_tags %}
    ```
2.  Add the following as close to the start of the `<head>` element of the template page as possible. Place this after any meta tags specifying a charset property or any `http-equiv` meta tag for `X-UA-Compatible`.

    ```django
    {% newrelic_browser_timing_header %}
    ```
3.  At the end of the `<body>` element of the template page, add:

    ```django
    {% newrelic_browser_timing_footer %}
    ```
