Skip to main content

djinsight

Track page views. Query with AI.

Your Django app's analytics, exposed to Claude and AI agents via MCP.

PyPI version Python


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

  1. Install with MCP support:
pip install djinsight[mcp]
  1. 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"
			}
		}
	}
}
  1. 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

Metadata

Release files for djinsight 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djinsight 0.4.2
File Size Uploaded Provenance Actions
djinsight-0.4.2.tar.gz 172.7 kB Without provenance Details for djinsight-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for djinsight 0.4.2
File Interpreter ABI Platform Actions
djinsight-0.4.2-py3-none-any.whl Python 3 none any Details for djinsight-0.4.2-py3-none-any.whl

Total release size: 338.6 kB

Release files / djinsight-0.4.2.tar.gz

Download URL djinsight-0.4.2.tar.gz
Size 172.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0d0db094071ac4f78ad051976f4382f8a1135b44bfedc2022d446e66c3a65967
BLAKE2b-256 checksum
How to use checksums
2dc3e2079be997ae87fb5ade0cd4276c56c8f1984b73ad75517609abb472f14d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / djinsight-0.4.2-py3-none-any.whl

Download URL djinsight-0.4.2-py3-none-any.whl
Size 165.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68cf4b8a92aaaee63cf15653112a0531949c992753a2c1eba1fa2df7784e91ad
BLAKE2b-256 checksum
How to use checksums
fd0b0041127800d2beeb70b53faa93433d4b1c58e116738db7ba969d4fb73482
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for djinsight 0.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page