--- title: "Flask" description: "Add Pulse analytics to your Flask app. Jinja2 template integration." category: "backend" brandColor: "#3BABC3" officialUrl: "https://flask.palletsprojects.com" relatedIds: ["django", "htmx", "express"] date: "2026-03-28" --- 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. ```html filename="templates/base.html" {% if not config.DEBUG %} {% endif %} {% block title %}My Flask App{% endblock %} {% block content %}{% endblock %} ``` For more details, see the [Flask template docs](https://flask.palletsprojects.com/en/stable/patterns/templateinheritance/).