Black Friday: Sumly for life, one payment from $79 · until 1 Declifetime from $79 →

Add Sumly to a Django site

The line goes into the head of the base template your pages extend, outside any block, so no page can leave it out by accident.

Step by step

  1. 1

    In Sumly, open Visitors and copy your project's line.

  2. 2

    Paste it into the <head> of your base.html, outside any {% block %}, so pages that extend it cannot replace it.

  3. 3

    Deploy. Open the site and the visit shows on Visitors.

Plain HTML, outside the blocks.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>{% block title %}My site{% endblock %}</title>
    <script defer src="https://sumly.dev/s.js" data-site="sl_your_key"></script>
</head>
<body>
    {% block content %}{% endblock %}
</body>
</html>

Or let your coding assistant do it

Paste this into Claude Code, Cursor or Codex in your project. It fits the code to how your project is built, asks you for the dashboard steps and leaves the keys to you.

See what it says
Set up Django for Sumly in this project.

Sumly (https://sumly.dev) shows revenue next to the visits and app users it came from. The full guide is https://sumly.dev/install/django; read it if anything below is unclear.

Steps:
1. In Sumly, open Visitors and copy your project's line.
2. Paste it into the `<head>` of your `base.html`, outside any `{% block %}`, so pages that extend it cannot replace it.
3. Deploy. Open the site and the visit shows on Visitors.

base.html: Plain HTML, outside the blocks.
```
<!DOCTYPE html>
<html lang="en">
<head>
    <title>{% block title %}My site{% endblock %}</title>
    <script defer src="https://sumly.dev/s.js" data-site="sl_your_key"></script>
</head>
<body>
    {% block content %}{% endblock %}
</body>
</html>
```

Checkout: For a Stripe Checkout your view creates: pass the visitor along.
```
session = stripe.checkout.Session.create(
    # …your line items, success_url and so on
    mode="subscription",
    subscription_data={"metadata": {"sumly_visitor_id": request.COOKIES.get("sumly_vid", "")}},
)
```

How to work:
- Look at how this project is built first, and fit the code to its framework and its way of doing things; the examples above are a starting point, not something to paste as is.
- Steps that happen in a dashboard (Sumly, or Django's own) are mine: tell me exactly what to click, then wait for me.
- Keys the code needs belong in environment variables, never in the code or the repository. Never ask me to paste a secret key into this chat; tell me which variable to set.
- Change only what this needs, show me the changes before you commit, and tell me how to check that it works.
- sl_your_key stands for the project's public key; it is on the Visitors page in Sumly. Ask me for it.

Checkout

Stripe Payment Links, pricing tables and buy buttons, Polar checkout links, Paddle buttons and Gumroad product links on your pages carry the visitor into checkout by themselves. For a checkout your own server creates, pass the sumly_vid cookie as metadata named sumly_visitor_id, or send the buyer back to a page with the script and ?session_id={CHECKOUT_SESSION_ID} (Stripe) or ?checkout_id={CHECKOUT_ID} (Polar). Keep that id on the page a server redirect leads to: it is the surest link. Without it, Sumly takes the one payment made just before a buyer arrives straight from the provider's checkout, when the browser says where they came from. Once your site names signed-in people with sumly.identify({ email, name }), a payment with the same e-mail links to them too.

Signed-in people

To see who a signed-in visitor is, call sumly.identify({ id: user.id, name: user.name, email: user.email }) on the page once they sign in. Only what you pass is sent, by POST, never in a page address; it waits for consent where the law asks, and only the id, name and e-mail are kept. People, their paths and their payments then show the name. No server and no key needed.

Your own domain

Recommended, so ad blockers do not stop the script: one DNS record serves it from your own address. Under Visitors › Add tracking, use the suggested signal.your-site.com and add the CNAME it shows; on Cloudflare, paste a DNS token and Sumly adds it for you, and Copy for AI gives a coding assistant the one change to the line. If your checkout or app is on another domain, add it under Projects and integrations › Other domains: the line then carries data-domains and one person stays one visitor across them.

Clicks and sections

Clicks on links to other sites count by themselves. Mark a button with data-sumly-event="signup" to count its clicks, and a section with data-sumly-scroll="pricing" to count the page views that reached it, a goal such as reached pricing.

From Django's own documentation, checked 4 November 2026: docs.djangoproject.com/en/stable/ref/templates/language .

Other platforms

Try it with your own projects

Sign in with Google or a code by e-mail and connect your first project. The first 14 days of a paid plan are free, with no card.

Start free

Or look around first: open the live demo.

Page names first, then what the pages say