{% extends "admin/_admin_base.html" %} {% from "components/pagination.html" import render_pagination %} {% block title %}Advertisements · Admin · CampusCart{% endblock %} {% block admin_header %}

Advertisements

Monitor campaign performance, rewarded advertisements, placements, and engagement across Student Bazaar.

New Advertisement
{% endblock admin_header %} {% block admin_content %} {% set has_filters = q or placement or ad_type or media_type or status or priority or date_from or date_to %} {% set rewarded = (placement_summary | selectattr('value', 'equalto', 'chat') | list | first) %} {% set has_data = overview and overview.total > 0 %}
{% set dash = '—' %} {% set kpis = [ ('Total Campaigns', overview.total, 'bi-megaphone', 'blue'), ('Active Campaigns', overview.status_counts.active, 'bi-play-circle', 'green'), ('Total Impressions', ('{:,}'.format(overview.total_impressions) if has_data else dash), 'bi-eye', 'blue'), ('Total Clicks', ('{:,}'.format(overview.total_clicks) if has_data else dash), 'bi-hand-index-thumb', 'violet'), ('Average CTR', (('0%' if overview.average_ctr == 0 else '%.1f%%'|format(overview.average_ctr)) if has_data else dash), 'bi-graph-up-arrow', 'amber'), ('Rewarded Views', ('{:,}'.format(rewarded.impressions) if has_data and rewarded else dash), 'bi-gift', 'green'), ] %} {% for label, value, icon, tone in kpis %}
{{ value }}
{{ label }}
No prior period
{% endfor %}
{% if storage %}
{% set scards = [ ('Total storage', storage.total_human, 'bi-hdd-stack', 'primary'), ('Advertisements', storage.ad_count, 'bi-collection', 'info'), ('Average media', storage.average_human, 'bi-bar-chart', 'success'), ('Largest video', storage.largest_video_human, 'bi-film', 'warning'), ('Unused files', storage.unused_files, 'bi-trash3', 'secondary'), ] %} {% for label, value, icon, color in scards %}
{{ value }}
{{ label }}
{% endfor %}
{% endif %}
{% if has_data %}

Impressions vs Clicks

Top campaigns by reach

Across all advertisements there are {{ '{:,}'.format(overview.total_impressions) }} impressions and {{ '{:,}'.format(overview.total_clicks) }} clicks.

Placement mix

Campaigns by placement

Campaigns by placement: {% for p in placement_summary %}{{ p.label }} {{ p.count }}{{ ', ' if not loop.last }}{% endfor %}.

New campaigns

Advertisements created over time
{% else %} {% for title, desc in [('Impressions vs Clicks', 'Top campaigns by reach'), ('Placement mix', 'Campaigns by placement'), ('New campaigns', 'Advertisements created over time')] %}

{{ title }}

{{ desc }}

No data yet

{% endfor %} {% endif %}
{% for p in placement_summary %}
{% if p.value == 'chat' %} {% elif p.value == 'landing' %} {% elif p.value == 'marketplace' %} {% elif p.value == 'sidebar' %} {% else %}{% endif %} {{ p.label }} {{ p.count }}
{{ '{:,}'.format(p.impressions) }}Impressions
{{ '{:,}'.format(p.clicks) }}Clicks
{{ '0%' if p.ctr == 0 else '%.1f%%'|format(p.ctr) }}CTR
{% endfor %}
{% if rows %} {# Hidden carrier form: the row checkboxes and every bulk control associate with it via form="bulkForm", so the visible sticky bar can live outside the form and share a tall containing block with the table (needed for sticky to hold while the table scrolls). #} {# NB: no data-bulk-form here — that hook belongs to the listings page's global initBulkSelect() (which would blindly preventDefault this form's submit). This page manages its own bulk UX below, targeting the form by id. #}
0 advertisements selected
{% for row in rows %} {% set ad = row.ad %} {% set pr = ad.priority %} {% set ctr_txt = '0%' if row.ctr == 0 else '%.1f%%'|format(row.ctr) %} {% endfor %}
Preview Title Type Placement Weight Status Start End Impr. Clicks CTR Active Actions
{# Media preview — image opens enlarged, video opens the player; icon-only ads are static. #} {% if ad.redirect_url %}
{{ ad.redirect_url }}
{% endif %}
{{ '{:,}'.format(ad.impression_count) }} {{ '{:,}'.format(ad.click_count) }} CTR {{ ctr_txt }} {% if ad.placement.value == 'chat' and row.rewarded and row.rewarded.has_activity %} {{ '%.0f%%'|format(row.rewarded.completion_rate) }} {{ row.rewarded.rewards_granted }} {% if row.rewarded.rejections %} {{ row.rewarded.rejections }}{% endif %} {% endif %}
{{ ad.advertisement_type.value|title }} {{ 'Video' if ad.is_video else 'Image' }} {% if ad.placement.value == 'chat' %}{% endif %}{{ ad.placement.display_name }} {{ 'High' if pr >= 8 else ('Medium' if pr >= 4 else 'Low') }} · {{ pr }} {% with status = row.status %}{% include "admin/advertisements/_status_badge.html" %}{% endwith %} {{ ad.start_at.strftime('%d %b %Y') if ad.start_at else '—' }} {{ ad.end_at.strftime('%d %b %Y') if ad.end_at else '—' }} {{ '{:,}'.format(ad.impression_count) }} {{ '{:,}'.format(ad.click_count) }}
{{ ctr_txt }}
{% if ad.is_active %} On {% else %} Off {% endif %}
{{ render_pagination(pagination, 'admin.ad_list', filter_args) }}
{% else %} {% if not has_filters %} {% set es_icon, es_title, es_body = 'bi-megaphone', 'No advertisements yet', 'No advertisements have been created. Create your first promotion to start reaching students across CampusCart.' %} {% elif q %} {% set es_icon, es_title, es_body = 'bi-search', 'No advertisements match your search', 'No advertisements match “' ~ q ~ '”. Try a different term or clear the search.' %} {% elif media_type == 'video' %} {% set es_icon, es_title, es_body = 'bi-camera-video', 'No video advertisements found', 'No video advertisements match your current filters.' %} {% elif media_type == 'image' %} {% set es_icon, es_title, es_body = 'bi-image', 'No image advertisements found', 'No image advertisements match your current filters.' %} {% elif placement == 'chat' or ad_type == 'rewarded' %} {% set es_icon, es_title, es_body = 'bi-gift', 'No rewarded advertisements match your current filters', 'Adjust the filters, or create a rewarded advertisement to appear in the chat watch-to-unlock flow.' %} {% else %} {% set es_icon, es_title, es_body = 'bi-funnel', 'No advertisements match your filters', 'Try clearing some filters to see more results.' %} {% endif %}

{{ es_title }}

{{ es_body }}

{% if has_filters %} Clear filters {% else %} Create advertisement {% endif %}
{% endif %} {% endblock %} {% block scripts %} {% if overview and overview.total > 0 %} {% endif %} {% endblock %}