views.py or a signal handler · open source (MIT) · ask in plain English

Add analytics to Django.

smolanalytics tracks a Django project two ways: server-side events posted from your views and signals, and a browser snippet in your base template that autocaptures pageviews, clicks and errors. No consent banner, cookieless. You query the data in plain English and get deterministic reports.

views.py or a signal handler
import requests

requests.post(
    "https://YOUR-INSTANCE/v1/events",
    headers={"Authorization": "Bearer WRITE_KEY"},
    json={
        "name": "signup",
        "distinct_id": str(user.id),
        "properties": {"plan": "pro"},
    },
    timeout=2,
)

# Web autocapture: put these two tags in templates/base.html <head>
# <script src="https://YOUR-INSTANCE/sdk.js"></script>
# <script>smolanalytics.init("WRITE_KEY", { host: "https://YOUR-INSTANCE" })</script>

a post_save signal is the natural hook for model events. push the POST to celery or a thread so it never slows the response.

how do I add analytics to django?

smolanalytics tracks a Django project two ways: server-side events posted from your views and signals, and a browser snippet in your base template that autocaptures pageviews, clicks and errors. No consent banner, cookieless. You query the data in plain English and get deterministic reports.

Django's signals map cleanly onto product analytics: post_save on your Order or Subscription is exactly the moment worth recording. Post it to /v1/events with a distinct_id and a properties dict, and keep the browser snippet in base.html for pageviews and rage clicks. The two streams share the same write key, so identify(user.id) in the template ties anonymous web sessions to the server-side user.

It's a single Go binary you can self-host next to your app (MIT) or run hosted from $29/mo. Answers are deterministic reports with a CI test that proves they aren't made up, so "weekly active users on the free plan" means the same thing every time. Ask from the dashboard bar or from your editor over MCP, no SQL and no dashboard assembly.

Honest pricing: 14-day full trial, no credit card. Then Solo $29/mo, never metered on seats or sites. Overage is $5/million with an emailed receipt, the dashboard never locks, and self-hosting the single Go binary is free forever (MIT).

Add analytics to Django tonight.

One snippet, or one endpoint. Tomorrow morning the verdict tells you which part of the funnel to fix.

questions

How do I add analytics to Django?
smolanalytics tracks a Django project two ways: server-side events posted from your views and signals, and a browser snippet in your base template that autocaptures pageviews, clicks and errors. No consent banner, cookieless. You query the data in plain English and get deterministic reports.
Do I need a cookie banner?
Not in cookieless mode. smolanalytics can run without storing anything on the device, so there is no consent banner to add. You still get visitors, referrers, funnels, retention, and paths, and AI-assistant referrals (chatgpt.com, claude.ai, perplexity.ai) show up as their own channel.
Is it enough for a real product, or just page counts?
It does funnels, retention, paths, cohorts, and a daily verdict on what to fix, from the same events, and you ask it in plain English. It deliberately skips session replay, feature flags, and experiments. If you want a straight answer on what to fix, that you own and can self-host free, it fits.

keep reading