MCP-first analytics for Django/Wagtail package for tracking page view statistics with Redis and async processing
Project description
djinsight
Track page views. Query with AI.
Your Django app's analytics, exposed to Claude and AI agents via MCP.
The Problem
You want page view analytics. But you also want Claude to answer questions like:
"What are my top 5 articles this week?"
Most analytics packages don't talk to AI. djinsight does.
Installation
pip install djinsight
Add to settings.py:
INSTALLED_APPS += ['djinsight']
DJINSIGHT = {
'ENABLE_TRACKING': True,
'USE_REDIS': False,
'USE_CELERY': False,
}
Run migrations:
python manage.py migrate
Add URLs to urls.py:
urlpatterns = [
path('djinsight/', include('djinsight.urls')),
]
Done.
Usage
Track a page
Add to any template:
{% load djinsight_tags %}
{% track %}
That's it. Views are now tracked.
Display stats
{% stats metric="views" period="week" %}
{% stats metric="views" period="week" output="chart" %}
Connect to Claude
- Install with MCP support:
pip install djinsight[mcp]
- Add to Claude Desktop config (
~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"djinsight": {
"command": "python",
"args": ["-m", "djinsight.mcp"],
"env": {
"DJANGO_SETTINGS_MODULE": "your_project.settings"
}
}
}
}
- Restart Claude Desktop.
13 tools available:
- Basic:
get_page_stats,get_top_pages,list_tracked_models - Periods:
get_period_stats,compare_periods - Trends:
get_trending_pages - Referrers:
get_referrer_stats,get_traffic_sources - Behavior:
get_device_breakdown,get_hourly_pattern - Cross-model:
get_site_overview,compare_content_types - Search:
search_pages
Now Claude can answer:
- "What are my top 10 pages this week?"
- "Where does my traffic come from?"
- "Which pages are trending up?"
- "Compare mobile vs desktop traffic"
High Traffic?
Use Redis + Celery for async processing:
DJINSIGHT = {
'ENABLE_TRACKING': True,
'USE_REDIS': True,
'USE_CELERY': True,
'REDIS_HOST': 'localhost',
}
Start Celery:
celery -A your_project worker -l info
celery -A your_project beat -l info
Stats Tag Options
{% stats metric="views" period="week" output="chart" chart_type="line" %}
| Parameter | Options |
|---|---|
metric |
views, unique_views |
period |
today, week, month, year, total |
output |
text, chart, json, badge |
chart_type |
line, bar |
Custom Backends
Swap any component:
DJINSIGHT = {
'PROVIDER_CLASS': 'myapp.providers.CustomProvider',
'WIDGET_RENDERER': 'myapp.renderers.CustomRenderer',
}
License
MIT
Links
Sponsors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djinsight-0.4.2.tar.gz.
File metadata
- Download URL: djinsight-0.4.2.tar.gz
- Upload date:
- Size: 172.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d0db094071ac4f78ad051976f4382f8a1135b44bfedc2022d446e66c3a65967
|
|
| MD5 |
84ba5bec50e2fcb4cad29c8de3936144
|
|
| BLAKE2b-256 |
2dc3e2079be997ae87fb5ade0cd4276c56c8f1984b73ad75517609abb472f14d
|
File details
Details for the file djinsight-0.4.2-py3-none-any.whl.
File metadata
- Download URL: djinsight-0.4.2-py3-none-any.whl
- Upload date:
- Size: 165.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68cf4b8a92aaaee63cf15653112a0531949c992753a2c1eba1fa2df7784e91ad
|
|
| MD5 |
95d107a3c0e2663b1493ce80a914f190
|
|
| BLAKE2b-256 |
fd0b0041127800d2beeb70b53faa93433d4b1c58e116738db7ba969d4fb73482
|