{% extends 'base.html' %} {% load djinsight_tags %} {% block title %}Popular Content - djinsight Example{% endblock %} {% block content %}

📊 Popular Content Dashboard

← Home
🚀 djinsight Analytics Dashboard

This dashboard demonstrates how djinsight can track and display analytics for different types of content. All statistics are updated in real-time using Redis and tracked automatically.

📰 Most Popular Articles

{% for article in popular_articles %}
{{ article.title }}

{{ article.content|truncatewords:20 }}

By {{ article.author }} • {{ article.published_at|date:"M d, Y" }}
{% total_views_stat obj=article %} {% unique_views_stat obj=article %} {% views_today_stat obj=article %} {% last_viewed_stat obj=article %}
{% empty %}

No articles with views yet. Create some articles and visit them to see analytics!

{% endfor %}

🛍️ Popular Products

{% for product in popular_products %}
{{ product.name }}

${{ product.price }} • {{ product.category }}

{% total_views_stat obj=product %} {% unique_views_stat obj=product %}
{% empty %}

No products with views yet.

Add Products
{% endfor %}

🎓 Popular Courses

{% for course in popular_courses %}
{{ course.title }}

{{ course.instructor }} • {{ course.difficulty|title }}

{% total_views_stat obj=course %} {% unique_views_stat obj=course %}
{% empty %}

No courses with views yet.

Add Courses
{% endfor %}

🔧 djinsight Features Demonstrated

Modular Components
  • {% templatetag openblock %} total_views_stat {% templatetag closeblock %}
  • {% templatetag openblock %} unique_views_stat {% templatetag closeblock %}
  • {% templatetag openblock %} views_today_stat {% templatetag closeblock %}
  • {% templatetag openblock %} last_viewed_stat {% templatetag closeblock %}
  • {% templatetag openblock %} live_stats_counter {% templatetag closeblock %}
Automatic Tracking
  • Page views tracked via JavaScript
  • Unique visitors by session
  • Real-time Redis storage
  • Background Celery processing
  • Multiple content types
Flexible Display
  • Individual stat components
  • Custom layouts and styling
  • Live auto-refresh counters
  • Number formatting (1.2K, 3.4M)
  • Responsive design ready
🎯 Quick Start:
  1. Add PageViewStatisticsMixin to your model
  2. Include {% templatetag openblock %} page_view_tracker {% templatetag closeblock %} in templates
  3. Use any combination of stat components: {% templatetag openblock %} total_views_stat {% templatetag closeblock %}, etc.
  4. Style with CSS classes: .djinsight-stat-item, .djinsight-stat-value
{% endblock %} {% block extra_css %} {% endblock %}