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.
If you need to use manual instrumentation with Django templates, you can manually register and use the newrelic_tags
tag library.
Contents
Add 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.
To make this template tag library available, you must manually add newrelic.extras.framework_django
to the list of INSTALLED_APPS
in your Django project settings files.
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.
{% load ... newrelic_tags %}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 anyhttp-equiv
meta tag forX-UA-Compatible
.{% newrelic_browser_timing_header %}At the end of the
<body>
element of the template page, add:{% newrelic_browser_timing_footer %}
For more help
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's and and documentation.