ComusThumbz 문서
관리자 로그인

Banner Stats

Overview

The Statistics Dashboard provides a comprehensive view of your advertising system's performance. It aggregates data from sponsors, banners, and placements to give you insights into impressions, clicks, click-through rates (CTR), and revenue.

Key Features

  • Real-time Overview Statistics - Active sponsors, banners, zones, and performance metrics
  • Performance Over Time - Daily statistics with 7, 30, and 90-day views
  • Top Performers - Ranked lists of best-performing banners, sponsors, and zones
  • Revenue Tracking - Monthly budget overview by sponsor
  • Quick Navigation - Direct links to manage sponsors, banners, and zones

What Data is Tracked

Metric Description Source
Impressions Number of times banners are displayed tblBannerAssets.impressions, tblBannerStats
Clicks Number of times banners are clicked tblBannerAssets.clicks, tblBannerStats
CTR Click-Through Rate (clicks/impressions × 100) Calculated
Monthly Budget Sponsor advertising budget tblSponsors.monthlybudget
Note: Statistics are calculated in real-time from the database. Historical data is stored in tblBannerStats for time-based reporting.

System Requirements

 

Configuration Required: This page requires the following system dependencies to function properly.

 

PHP Requirements

Requirement Minimum Recommended Notes
PHP Version 8.0 8.2+ Required for null coalescing operator
memorylimit 64M 128M Statistics aggregation
maxexecutiontime 30 60 For large dataset queries

Required PHP Extensions

Extension Required Purpose
mysqli Yes Database connectivity
json Yes AJAX response handling
session Yes CSRF protection, authentication

Required PHP Functions

Function Required For
bin2hex() CSRF token generation
randombytes() Secure CSRF token generation
mysqliprepare() Parameterized queries

Database Requirements

  • MySQL 5.7+ / MariaDB 10.3+
  • User must have SELECT permissions on statistics tables
  • Aggregation functions: SUM(), COUNT(), ROUND()
  • Date functions: DATE(), DATESUB(), CURDATE()

External Dependencies

Dependency Version Purpose
Font Awesome 6.5.1 Icons (CDN loaded)

Page Layout

Header Section

The page header contains:

Element Description
Breadcrumb Dashboard / Statistics
Page Title "Statistics Dashboard" with chart icon
Subtitle "Monitor performance, track metrics, and analyze sponsor engagement"
Navigation Buttons Quick links to related advertising pages

[Screenshot: Statistics page header]

Main Content Areas

The dashboard is organized into four main sections:

  1. Overview Statistics - Four summary cards at the top
  2. Performance Over Time - Daily statistics table (left, 2/3 width)
  3. Top Performers - Tabbed list of best performers (right, 1/3 width)
  4. Revenue & Quick Actions - Revenue stats and navigation (bottom row)

[Screenshot: Full statistics dashboard layout]


Overview Statistics Cards

Four summary cards provide at-a-glance metrics:

Active Sponsors Card

Element Description Color
Icon Building Green (#22c55e)
Main Value Count of active sponsors -
Label "Total Active Sponsors" -
Subtext Number of sub-sponsors -

Data Source:

SELECT COUNT() FROM tblSponsors WHERE active = 1;
SELECT COUNT() FROM tblSubSponsors WHERE active = 1;

Active Banners Card

Element Description Color
Icon Image Orange (#f59e0b)
Main Value Count of active banners -
Label "Live Banner Campaigns" -
Subtext Number of active zones -

Data Source:

SELECT COUNT() FROM tblBannerAssets WHERE status = 'active';
SELECT COUNT() FROM tblBannerPlacements WHERE active = 1;

Total Performance Card

Element Description Color
Icon Eye Purple (#8b5cf6)
Main Value Total impressions (all time) -
Label "Total Impressions" -
Subtext Total clicks and overall CTR Green

Data Source:

SELECT SUM(impressions), SUM(clicks) FROM tblBannerAssets;
-- CTR = (clicks / impressions)  100

Recent Activity Card

Element Description Color
Icon Chart Line Blue (#3b82f6)
Main Value Impressions (last 30 days) -
Label "Impressions (30 days)" -
Subtext Recent clicks and CTR Green

Data Source:

SELECT SUM(impressions), SUM(clicks)
FROM tblBannerStats
WHERE date >= DATESUB(CURDATE(), INTERVAL 30 DAY);

[Screenshot: Overview statistics cards]


Performance Over Time

The Performance Over Time section shows daily statistics in a table format.

Time Range Controls

Three buttons allow selecting the time range:

Button Range Default
7 Days Last 7 days No
30 Days Last 30 days Yes (default)
90 Days Last 90 days No

[Screenshot: Time range buttons]

Data Table Columns

Column Icon Description
Date Calendar The date of the statistics
Impressions Eye Total impressions that day
Clicks Mouse Pointer Total clicks that day
CTR Percentage Click-through rate percentage

CTR Color Coding:

  • Green (#22c55e) if CTR >= 1%
  • Orange (#f59e0b) if CTR < 1%

 

Tip: A CTR of 1% or higher is generally considered good for display advertising. The color coding helps you quickly identify days with strong or weak performance.

 

Data Source:

SELECT

    DATE(date) as date,

    SUM(impressions) as impressions,

    SUM(clicks) as clicks,

    ROUND((SUM(clicks) / SUM(impressions))  100, 2) as ctr

FROM tblBannerStats

WHERE date >= DATESUB(CURDATE(), INTERVAL ? DAY)

GROUP BY DATE(date)

ORDER BY date ASC;

 

Empty State

If no data exists for the selected period:

[Chart icon]
No performance data available for the selected period

[Screenshot: Performance table with data]


Top Performers

The Top Performers section shows ranked lists of best-performing items with three tabs.

Tabs

Tab Data Shown Ranking By
Banners Individual banner performance Total clicks
Sponsors Sponsor aggregate performance Total clicks
Zones Zone/placement performance Total clicks

[Screenshot: Top performers tabs]

Performer List Item Layout

Each item in the list shows:

Element Description
Rank Medal icon (gold for #1-3, gray for rest) and position number
Name Banner title, sponsor name, or zone name
Details "by [Sponsor]" for banners, "[N] banners" for sponsors/zones
Clicks Total click count (green)
CTR Click-through rate percentage

Banners Tab Data

SELECT ba.title, ba.impressions, ba.clicks,
       ROUND((ba.clicks / ba.impressions)  100, 2) as ctr,
       s.name as sponsorname
FROM tblBannerAssets ba
LEFT JOIN tblSponsors s ON ba.sponsorid = s.id
WHERE ba.status = 'active' AND ba.impressions > 0
ORDER BY ba.clicks DESC
LIMIT 10;

Sponsors Tab Data

SELECT s.name,
       SUM(ba.impressions) as impressions,
       SUM(ba.clicks) as clicks,
       ROUND((SUM(ba.clicks) / SUM(ba.impressions))  100, 2) as ctr,
       COUNT(ba.id) as bannercount
FROM tblSponsors s
LEFT JOIN tblBannerAssets ba ON s.id = ba.sponsorid
WHERE s.active = 1
GROUP BY s.id
HAVING impressions > 0
ORDER BY clicks DESC
LIMIT 10;

Zones Tab Data

SELECT bp.zonename,
       SUM(ba.impressions) as impressions,
       SUM(ba.clicks) as clicks,
       ROUND((SUM(ba.clicks) / SUM(ba.impressions))  100, 2) as ctr,
       COUNT(ba.id) as bannercount
FROM tblBannerPlacements bp
LEFT JOIN tblBannerAssets ba ON bp.id = ba.placementid
WHERE bp.active = 1
GROUP BY bp.id
HAVING impressions > 0
ORDER BY clicks DESC
LIMIT 10;

 

Note: Only items with impressions > 0 are shown. Items with zero impressions are excluded to keep the list meaningful.

 

Empty State

If no performance data exists:

[Chart bar icon]
No performance data available

[Screenshot: Top performers list with data]


Revenue Statistics

The Top Revenue Sponsors section displays sponsors ranked by their monthly advertising budget.

Revenue Item Layout

Each item shows:

Element Description
Sponsor Name Building icon + sponsor name
Monthly Budget Green dollar amount

Data Source:

SELECT s.name, s.monthlybudget,
       COUNT(ba.id) as bannercount,
       SUM(ba.clicks) as totalclicks
FROM tblSponsors s
LEFT JOIN tblBannerAssets ba ON s.id = ba.sponsorid
WHERE s.active = 1 AND s.monthlybudget > 0
GROUP BY s.id
ORDER BY s.monthlybudget DESC
LIMIT 10;

 

Warning: Only sponsors with a monthly budget greater than $0 are displayed. Sponsors without budgets are excluded.

 

Empty State

If no sponsors have budgets set:

[Dollar sign icon]
No revenue data available

 

Tip: To track revenue, set the Monthly Budget field when creating or editing sponsors in Admin Panel → Advertising → Sponsors.

 

[Screenshot: Revenue statistics section]


Quick Actions

The Quick Actions panel provides direct links to related management pages:

Action Icon Destination
Manage Sponsors Building sponsorsmanagement.php
Manage Banners Image bannermanagement.php
Add New Banner Plus Circle addbanner.php
Manage Zones Grid bannerzones.php
Note: Quick actions provide a convenient way to navigate to frequently used pages directly from the statistics dashboard.

[Screenshot: Quick actions panel]


Understanding Metrics

Impressions

Definition: The number of times a banner is displayed to visitors.

  • Counted each time a banner renders on a page
  • May include multiple views from the same visitor
  • Higher impressions = more visibility

Clicks

Definition: The number of times visitors click on a banner.

  • Counted each time someone clicks a banner
  • Should redirect to the sponsor/advertiser's URL
  • Revenue often tied to click counts

Click-Through Rate (CTR)

Definition: The percentage of impressions that result in clicks.

Formula:

CTR = (Clicks / Impressions) × 100

 

Benchmarks:

CTR Range Rating Interpretation
> 2% Excellent High engagement
1% - 2% Good Average performance
0.5% - 1% Below Average May need optimization
< 0.5% Poor Review creative/placement
Tip: Improve CTR by testing different banner designs, improving targeting with categories, or trying different placement zones.

 

Monthly Budget

Definition: The advertiser's allocated monthly spending.

  • Set per sponsor in sponsor management
  • Used for revenue forecasting
  • Does not affect banner display logic

Best Practices

Regular Monitoring

 

Tip: Check the statistics dashboard at least weekly to identify trends and issues early.

 

What to look for:

  • Sudden drops in impressions (banner issues?)
  • CTR changes (creative fatigue?)
  • New top performers (successful campaigns)

 

Analyzing Performance

  1. Compare Time Periods - Use 7, 30, 90-day views to spot trends
  2. Check All Tabs - Review banners, sponsors, and zones separately
  3. Correlate with Changes - Did a banner change coincide with performance shifts?

Optimizing Based on Data

Observation Possible Action
Low CTR Test new banner creative
One banner dominates Add more variety
Zone underperforming Review zone placement
Sponsor has no clicks Check banner is active

Data Accuracy

 

Warning: Statistics are only accurate if the banner tracking system is properly implemented. Verify that impressions and clicks are being recorded by testing a banner.

 


Troubleshooting

Common Issues

No Data Showing

Symptoms: All statistics show 0 or "No data available"

Possible Causes:

  1. No active banners in the system
  2. Banner tracking not implemented
  3. tblBannerStats table is empty

 

Solutions:

  1. Create and activate at least one banner
  2. Implement banner impression/click tracking in frontend
  3. Verify database tables exist and have data

 

-- Check if there's any data
SELECT COUNT() FROM tblBannerAssets WHERE impressions > 0;
SELECT COUNT() FROM tblBannerStats;

Page Loads Slowly

Cause: Large datasets with complex aggregation queries.

Solutions:

  1. Add indexes to statistics tables
  2. Consider archiving old data
  3. Increase maxexecutiontime in php.ini

 

-- Useful indexes for performance
CREATE INDEX idxstatsdate ON tblBannerStats(date);
CREATE INDEX idxstatsbannerdate ON tblBannerStats(bannerid, date);

CTR Shows 0% Despite Clicks

Cause: Division by zero if impressions = 0

Solution: The code already handles this with:

CASE WHEN impressions > 0 THEN ROUND((clicks / impressions)  100, 2) ELSE 0 END

 

If still showing 0%, verify impressions are being tracked.

Revenue Section Empty

Cause: No sponsors have monthlybudget > 0

Solution:

  1. Navigate to Admin Panel → Advertising → Sponsors
  2. Edit sponsors and set their monthly budget
  3. Save and return to statistics

 

Top Performers Not Updating

Cause: Browser caching or data not being recorded

Solutions:

  1. Hard refresh the page (Ctrl+F5)
  2. Verify banner activity is being logged
  3. Check the AJAX responses in browser developer tools

 

Database Queries for Debugging

Verify Table Structure

DESCRIBE tblBannerStats;
DESCRIBE tblBannerAssets;

Check Recent Activity

SELECT DATE(date) as day, SUM(impressions), SUM(clicks)
FROM tblBannerStats
WHERE date >= DATESUB(CURDATE(), INTERVAL 7 DAY)
GROUP BY DATE(date)
ORDER BY day DESC;

Find Banners with Most Clicks

SELECT ba.id, ba.title, ba.clicks, ba.impressions,
       s.name as sponsor
FROM tblBannerAssets ba
LEFT JOIN tblSponsors s ON ba.sponsorid = s.id
ORDER BY ba.clicks DESC
LIMIT 10;

Check for Data Gaps

-- Find days with no statistics
SELECT DATEADD('2024-01-01', INTERVAL n DAY) as date
FROM (
    SELECT @row := @row + 1 as n
    FROM tblBannerStats, (SELECT @row := -1) r
    LIMIT 365
) numbers
WHERE DATEADD('2024-01-01', INTERVAL n DAY) <= CURDATE()
  AND DATEADD('2024-01-01', INTERVAL n DAY) NOT IN (
      SELECT DISTINCT DATE(date) FROM tblBannerStats
  );

Translatable Strings

The following strings should be added to backendtranslations.md for internationalization:

Page Title and Navigation

statisticstitle = "Statistics Dashboard"
statisticssubtitle = "Monitor performance, track metrics, and analyze sponsor engagement"
breadcrumbstatistics = "Statistics"

Overview Cards

statactivesponsors = "Active Sponsors"
stattotalactivesponsors = "Total Active Sponsors"
statsubsponsors = "sub-sponsors"
statactivebanners = "Active Banners"
statlivecampaigns = "Live Banner Campaigns"
statactivezones = "active zones"
stattotalperformance = "Total Performance"
stattotalimpressions = "Total Impressions"
statclicks = "clicks"
statctr = "CTR"
statrecentactivity = "Recent Activity"
statimpressions30days = "Impressions (30 days)"

Performance Section

sectionperformanceovertime = "Performance Over Time"
btn7days = "7 Days"
btn30days = "30 Days"
btn90days = "90 Days"
tabledate = "Date"
tableimpressions = "Impressions"
tableclicks = "Clicks"
tablectr = "CTR"

Top Performers Section

sectiontopperformers = "Top Performers"
tabbanners = "Banners"
tabsponsors = "Sponsors"
tabzones = "Zones"
bysponsor = "by"
bannercount = "banners"

Revenue Section

sectiontoprevenue = "Top Revenue Sponsors"

Quick Actions Section

sectionquickactions = "Quick Actions"
actionmanagesponsors = "Manage Sponsors"
actionmanagebanners = "Manage Banners"
actionaddbanner = "Add New Banner"
actionmanagezones = "Manage Zones"

Empty States

emptynoperformance = "No performance data available"
emptynoperformanceperiod = "No performance data available for the selected period"
emptynorevenue = "No revenue data available"

Loading States

loadingstatistics = "Loading statistics..."
loadingchart = "Loading chart data..."
loadingperformers = "Loading performers..."
loadingrevenue = "Loading revenue data..."

Error Messages

errorloadingoverview = "Error loading overview stats"
errorloadingperformers = "Error loading top performers"
errorloadingdaily = "Error loading daily stats"
errorloadingrevenue = "Error loading revenue stats"
errorinvalidcsrf = "Invalid CSRF token"
errorinvalidtype = "Invalid type"

Navigation Buttons

navsponsors = "Sponsors"
navbanners = "Banners"
navaddbanner = "Add Banner"
navbannerzones = "Banner Zones"
navsubsponsors = "Sub-Sponsors"
navstatistics = "Statistics"


Changelog

Date Version Changes
2025-01-02 1.0 Initial documentation

This documentation is part of the ComusThumbz Admin Guide series.