{% extends "base.html" %} {% block title %}Admin Analytics · CampusCart{% endblock %} {% macro metric(label, value, icon, color, endpoint=none, params={}, tooltip='Management page coming soon.') %} {% set available = endpoint and has_endpoint(endpoint) %} {% set unavailable = endpoint and not available %}
{% if available %}
{{ value }}
{{ label }}
{% elif unavailable %}
{{ value }}
{{ label }}
{% else %}
{{ value }}
{{ label }}
{% endif %}
{% endmacro %} {% block content %}

Platform Analytics

Marketplace health, growth, engagement and Premium adoption across CampusCart.

{# ---------- Platform overview ---------- #} {% set o = dashboard.overview %}

Platform overview

{{ metric('Total Users', "{:,}".format(o.total_users), 'bi-people-fill', 'primary', endpoint='admin.users') }} {{ metric('New Users (30d)', "{:,}".format(o.new_users_30d), 'bi-person-plus-fill', 'info') }} {{ metric('Active Listings', "{:,}".format(o.active_listings), 'bi-bag-check-fill', 'success', endpoint='admin.listings', params={'status': 'active'}) }} {{ metric('Sold Listings', "{:,}".format(o.sold_listings), 'bi-cart-check-fill', 'secondary', endpoint='admin.listings', params={'status': 'sold'}) }} {{ metric('Total Listings', "{:,}".format(o.total_listings), 'bi-box-seam-fill', 'primary') }} {{ metric('Premium Members', "{:,}".format(o.premium_members), 'bi-star-fill', 'warning', endpoint='admin.users', params={'premium': 'active'}) }} {{ metric('Featured Listings', "{:,}".format(o.featured_listings), 'bi-stars', 'warning', endpoint='admin.listings', params={'featured': 1}) }} {{ metric('Advertisements', "{:,}".format(o.advertisements), 'bi-megaphone-fill', 'info', endpoint='admin.ad_list') }} {{ metric('Conversations', "{:,}".format(o.total_conversations), 'bi-chat-dots-fill', 'primary', endpoint='admin.conversations') }} {{ metric('Messages', "{:,}".format(o.total_messages), 'bi-envelope-fill', 'secondary') }} {{ metric('Offers', "{:,}".format(o.total_offers), 'bi-tag-fill', 'success', endpoint='admin.offers') }} {{ metric('Total Views', "{:,}".format(o.total_views), 'bi-eye-fill', 'info') }} {{ metric('Pending Reports', "{:,}".format(o.pending_reports), 'bi-flag-fill', 'danger', endpoint='admin.reports', params={'status': 'pending'}) }} {{ metric('Pending Verifications', "{:,}".format(o.pending_verifications), 'bi-patch-check-fill', 'warning', endpoint='admin.verifications') }}
{# ---------- Recent admin activity ---------- #}

Recent admin activity

{% if has_endpoint('admin.audit_logs') %} View all {% endif %}
{% if dashboard.recent_admin_activity %}
    {% for a in dashboard.recent_admin_activity %} {% set item_url = url_for('admin.audit_logs', highlight=a.id) if has_endpoint('admin.audit_logs') else None %}
  • {% if item_url %}{{ a.label }}{% else %}{{ a.label }}{% endif %} {% if a.entity_name %}· {{ a.entity_name }}{% endif %}

    {{ a.admin_name }} ·
  • {% endfor %}
{% else %}

No administrative activity recorded yet.

{% endif %}
{# ---------- Report moderation ---------- #} {% set ma = dashboard.moderation_analytics %}

Report moderation

{% if has_endpoint('admin.reports') %}Open queue {% endif %}
{{ "{:,}".format(ma.reports_this_month) }}
Reports this month
{{ ('%.1f' % ma.avg_resolution_hours ~ ' h') if ma.avg_resolution_hours is not none else '—' }}
Avg. resolution time
{{ ma.most_common_reason or '—' }}
Most common reason
{{ "{:,}".format(o.pending_reports) }}
Pending review

Reports · last 30 days

Top reported categories

{% if ma.top_categories %}
    {% for name, count in ma.top_categories %}
  • {{ name }}{{ count }}
  • {% endfor %}
{% else %}

No reported categories yet.

{% endif %}

Top reported sellers

{% if ma.top_sellers %}
    {% for seller in ma.top_sellers %}
  • {% if has_endpoint('admin.reports') and seller.public_id %}{{ seller.name }}{% else %}{{ seller.name }}{% endif %} {{ seller.count }}
  • {% endfor %}
{% else %}

No reported sellers yet.

{% endif %}
{# ---------- Recent reports ---------- #}

Recent reports

{% if has_endpoint('admin.reports') %}View all {% endif %}
{% if dashboard.recent_reports %}
{% set status_badge = {'pending': 'warning', 'under_review': 'info', 'resolved': 'success', 'dismissed': 'secondary'} %} {% for r in dashboard.recent_reports %} {% set url = url_for('admin.report_detail', public_id=r.public_id) if has_endpoint('admin.report_detail') else None %} {% endfor %}
{{ r.short_id }} {{ r.entity_name }} {{ r.reason }} {{ r.status_label }}
{% else %}

No reports have been submitted.

{% endif %}
{# ---------- Marketplace activity (30-day trends) ---------- #}

Marketplace activity · last 30 days

{% for cid, title in [('usersChart','New Users'), ('listingsChart','New Listings'), ('viewsChart','Listing Views'), ('messagesChart','Messages'), ('offersChart','Offers')] %}

{{ title }}

{% endfor %}
{# ---------- Traffic ---------- #} {% set tr = dashboard.traffic %}

Traffic insights

{{ metric('Most Active Day', tr.most_active_day or '—', 'bi-calendar-week', 'primary') }} {{ metric('Peak Hour', tr.peak_hour_label or '—', 'bi-clock-fill', 'info') }} {{ metric('Unique Visitors (30d)', "{:,}".format(tr.unique_visitors), 'bi-person-badge', 'success') }} {{ metric('Returning Visitors', "{:,}".format(tr.returning_visitors), 'bi-arrow-repeat', 'warning') }} {{ metric('Total Views (30d)', "{:,}".format(tr.total_views_30d), 'bi-eye-fill', 'info') }} {{ metric('Top Category', tr.top_category or '—', 'bi-tags-fill', 'secondary', endpoint=('main.marketplace' if tr.top_category_id else none), params={'category': tr.top_category_id}) }}

Top viewed categories (30 days)

Listing status distribution

{# ---------- Premium + Advertisements ---------- #}

Premium

{% set p = dashboard.premium %}
{{ metric('Active Members', "{:,}".format(p.active_members), 'bi-star-fill', 'warning') }} {{ metric('Expired Members', "{:,}".format(p.expired_members), 'bi-hourglass-bottom', 'secondary') }} {{ metric('Featured Listings', "{:,}".format(p.featured_listings), 'bi-stars', 'warning') }} {{ metric('Avg Featured Days Left', p.avg_featured_days_remaining, 'bi-calendar-check', 'info') }} {{ metric('Adoption', p.adoption_pct ~ '%', 'bi-graph-up-arrow', 'success') }} {{ metric('Conversion Rate', p.conversion_pct ~ '%', 'bi-person-check-fill', 'primary') }}

Premium vs Free

Advertisements

{% set ad = dashboard.advertisements %} {% if ad.total == 0 %}

No advertisements yet

Create your first promotion to start reaching students.

Create Advertisement
{% else %}
{{ metric('Total Ads', "{:,}".format(ad.total), 'bi-megaphone-fill', 'primary', endpoint='admin.ad_list') }} {{ metric('Active Ads', "{:,}".format(ad.active), 'bi-broadcast', 'success', endpoint='admin.ad_list', params={'status': 'active'}) }} {{ metric('Expired Ads', "{:,}".format(ad.expired), 'bi-hourglass-bottom', 'warning', endpoint='admin.ad_list', params={'status': 'expired'}) }} {{ metric('Ad Views', "{:,}".format(ad.impressions), 'bi-eye', 'info') }} {{ metric('Ad Clicks', "{:,}".format(ad.clicks), 'bi-hand-index-thumb', 'secondary') }} {{ metric('CTR', (ad.ctr ~ '%') if ad.ctr is not none else 'Not Available', 'bi-percent', 'primary') }}
{% endif %} {# ---------- Top sellers ---------- #}

Top sellers

{% for s in dashboard.top_sellers %} {% else %} {% endfor %}
#SellerListingsViewsFavsOffersScoreActions
{{ loop.index }} {{ s.name }}{% if s.is_premium %} Premium{% endif %} {{ s.listings }} {{ "{:,}".format(s.views) }} {{ "{:,}".format(s.favorites) }} {{ "{:,}".format(s.offers) }} {{ "{:,}".format(s.score) }} {% if s.public_id %} View Profile {% endif %}
No sellers yet.

Seller scores

{# ---------- Top listings ---------- #}

Top listings

{% for l in dashboard.top_listings %} {% set detail_url = url_for('marketplace.listing_detail', public_id=l.public_id) %} {% else %} {% endfor %}
ListingSellerViewsFavsOffersStatusAction
{% if l.image %}{% else %}{% endif %} {{ l.title }} {% if l.is_featured %}Featured{% endif %}
{{ l.seller }} {{ "{:,}".format(l.views) }} {{ "{:,}".format(l.favorites) }} {{ "{:,}".format(l.offers) }} {{ l.status|title }} View Listing
No listings yet.
{# ---------- Marketplace health + moderation + insights ---------- #}

Marketplace health

{% set h = dashboard.health %}
Avg views / listing
{{ h.avg_views_per_listing }}
Avg offers / listing
{{ h.avg_offers_per_listing }}
Avg conversations / listing
{{ h.avg_conversations_per_listing }}
Avg favorites / listing
{{ h.avg_favorites_per_listing }}
Avg messages / conversation
{{ h.avg_messages_per_conversation }}
Featured listings
{{ h.featured_pct }}%
Premium users
{{ h.premium_pct }}%

Moderation

{% set m = dashboard.moderation %}
Deleted listings
{{ m.deleted_listings }}
Reserved listings
{{ m.reserved_listings }}
Sold listings
{{ m.sold_listings }}
{% if m.reports_available %}
Reported listings
{{ m.reported_listings }}
Pending reports
{{ m.pending_reports }}
Resolved reports
{{ m.resolved_reports }}
{% endif %}
{% if not m.reports_available %}

Report moderation is not enabled yet.

{% endif %}

Growth insights

{% if dashboard.insights %}
    {% for insight in dashboard.insights %}
  • {{ insight }}
  • {% endfor %}
{% else %}

Not enough data for insights yet.

{% endif %}
{% endblock %} {% block scripts %} {% endblock %}