Back to Integrations

Flask Integration

Add the Pulse script to your Jinja2 base template with a debug guard.


Add to your base template

Use Jinja2's conditional to only load the script when DEBUG is off.

templates/base.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    {% if not config.DEBUG %}
    <script
      defer
      data-domain="your-site.com"
      src="https://pulse.ciphera.net/script.js"
    ></script>
    {% endif %}

    <title>{% block title %}My Flask App{% endblock %}</title>
</head>
<body>
    {% block content %}{% endblock %}
</body>
</html>

For more details, see the Flask template docs.

Related Integrations: Django, HTMX, Express