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.
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.