Документация ComusThumbz
Вход для Администратора

Traffic Stats

Traffic Stats Dashboard (trafficstats.php)

Overview

The Traffic Stats Dashboard is a comprehensive visitor analytics system for tracking all inbound traffic, visitor behavior, session journeys, content performance, search analytics, and AI-powered insights. It provides detailed metrics across 9 tabs covering everything from real-time active visitors to individual session timelines showing every page a visitor viewed, how long they stayed, and where they went next.

Location: Navigate to this page via Admin Panel -> Reports -> Traffic Stats

[Screenshot: traffic-stats-overview]


Feature Highlights

  • 9 analytics tabs -- Overview, Real-Time, Sessions, Sources, Pages, Tech & Geo, Engagement, Content, Search, plus an AI Insights tab
  • Bot filtering -- Automatic exclusion of 30+ known bot/crawler user agents (Facebook Crawler, Googlebot, Bingbot, etc.) with a "Show Bots" toggle to view bot traffic when needed
  • Period selector -- Today, 7 Days, 30 Days, 90 Days with all data dynamically reloaded
  • Period comparison -- All KPI cards show percentage change vs the previous period of equal length
  • Session drill-down -- Click "View Journey" on any session to see the full visitor timeline: every page viewed, time on page, scroll depth, and events fired
  • Content performance -- Track which videos, models, galleries, cam performers, and creators drive the most traffic
  • Search gap analysis -- Identify zero-result searches to discover content opportunities
  • AI-powered insights -- 5 AI analysis types (Traffic Digest, Anomaly Detection, Content Recommendations, SEO Suggestions, Audience Personas) with per-user cost control
  • CSV export -- Download any tab's data as CSV for external analysis
  • Sortable & filterable tables -- Column sorting on Sessions and Real-Time tabs, multi-filter on Sessions (device, browser, referrer, bounce, duration range, pages range)
  • Page-number pagination -- Traditional page navigation on all data tables
  • Geographic drill-down -- Click any country to see city-level breakdown
  • Full AdminLanguage integration -- All UI strings use dot-notation translation keys
  • CSRF protection -- All AJAX POST requests include a session-bound CSRF token
  • Responsive layout -- Mobile-friendly with CSS grid reflow at 768px breakpoints

Frontend Impact

This is an admin-only dashboard. However, the data it displays depends entirely on frontend tracking infrastructure:

  • Session & pageview data originates from Analytics.php (called in includes/header.php on every frontend page load)
  • Client-side events (time on page, scroll depth, exit page) originate from assets/js/analytics-tracker.js via ct/api/v1/analytics/event.php
  • Impression data originates from assets/js/impression-tracker.js via the impressions API
  • Click data originates from click.php which tracks all outbound content clicks
  • Search data originates from SearchController.php which logs queries to tblSearchHistory
  • Content ID tracking requires frontend pages to pass ?id= parameters in URLs
Note: If analytics tracking is not properly configured on your frontend pages (missing includes/header.php include, or analytics-tracker.js not loaded), this dashboard will show incomplete data. Verify that all frontend pages include the analytics header and that the footer loads the tracking scripts.

Getting to This Page

  1. Navigate to Admin Panel -> Reports
  2. Click Traffic Stats link
  3. The breadcrumb reads: Dashboard -> Traffic Stats (Dashboard links to main.php)
Note: This page was added to the Reports menu via a database insert into tblMenus with parent='Reports', url='trafficstats.php', iconclass='fas fa-route'.

Tabs Reference

1. Overview Tab

The default tab showing high-level KPIs and visual analytics.

KPI Cards (6 cards with period comparison arrows):

Card Metric Comparison
Total Sessions Session count for period % change vs previous period
Unique Visitors Distinct IP/session count % change
Total Pageviews Sum of all page views % change
Bounce Rate % of single-page sessions % change (inverted -- down is good)
Avg Duration Average session length in seconds % change
Pages / Session Average pages per session % change

Charts & Tables:

  • Sessions & Pageviews Line Chart -- Daily sessions and pageviews over the selected period
  • New vs Returning Visitors -- Two stat cards showing counts + percentages, with a trend line chart (uses browser fingerprint to identify returning visitors)
  • Day of Week Patterns -- Table showing sessions, avg duration, avg pages, and bounce rate by day of week (Sun-Sat)
  • Hour-of-Day Heatmap -- 7x24 grid (days x hours) color-coded from green (low) to red (high), showing exact peak traffic windows

[Screenshot: traffic-stats-overview-heatmap]


2. Real-Time Tab

Shows currently active visitors (last 5 minutes).

Features:

  • Active visitor count with green pulse indicator
  • Device type filter dropdown
  • Sortable columns: Page (A-Z), Pages Viewed (High-Low), Last Activity (Old-New)
  • Auto-refreshes every 15 seconds

 


3. Sessions Tab

Paginated list of all visitor sessions with comprehensive filtering and sorting.

Columns: Started, Duration, Pages, Device, Browser/OS, Referrer, Bounce, View Journey

Sorting: Click any column header to sort ascending/descending (arrow indicators show current sort)

Filters:

  • Device (dropdown of detected device types)
  • Browser (dropdown)
  • Referrer (dropdown including "Direct Traffic")
  • Bounce (All / Bounced / Not Bounced)
  • Duration range (min/max in seconds)
  • Pages range (min/max count)

 

Session Detail / Visitor Journey:
Click "View Journey" on any session to see:

  • Session info card (started, ended, duration, pages, events, device, browser, OS, referrer, IP, language, UTM parameters)
  • Full page journey timeline with Entry/Exit badges, time on page, scroll depth, page type, and associated events per page

 

[Screenshot: traffic-stats-session-journey]


4. Sources Tab

Traffic source analysis with three sections.

Source Type Classification (4 KPI cards):

  • Direct (no referrer)
  • Search (Google, Bing, Yahoo, Yandex, DuckDuckGo, Baidu, Ecosia, Ask)
  • Social (Facebook, Twitter, Reddit, Instagram, Pinterest, LinkedIn, TikTok, YouTube, Tumblr)
  • Referral (everything else)

 

UTM Campaign Dashboard:
Table of UTM-tagged traffic with source, medium, campaign, sessions, bounce rate, avg duration, pages/session. Only appears when UTM data exists.

Top Referrers:
Bar chart + paginated table of referrer domains with sessions, share %, bounce rate, avg duration, pages/session.

CSV Export: Download button on the referrer table.


5. Pages Tab

Top pages by view count with performance metrics.

Columns: Page Path (with title), Views, Unique Views, Avg Time on Page, Avg Scroll Depth, Exit Rate

Paginated. CSV export button.


6. Tech & Geo Tab

Technology, demographics, geographic, and language analytics.

Demographics Card (logged-in users only):

  • Logged-in vs Anonymous ratio bar
  • Gender distribution bar (male/female/other from tblCMSUserProfiles)
  • Age group histogram (Under 18 through 65+ from tblCMSUsers.birthday)

 

Note: Demographics data is only available for logged-in users who have completed their profile. Anonymous visitors are tracked by device/geo but not by gender/age.

Technology Grid (3 columns):

  • Devices (desktop/mobile/tablet bar chart)
  • Browsers (Chrome, Safari, Firefox, etc.)
  • Operating Systems (Windows, Android, iOS, macOS, Linux, etc.)

 

Language Distribution:
Bar chart of visitor Accept-Language header values.

Geographic Drill-Down:

  • Country level: sessions, region count, city count, avg duration. Click any country to drill down.
  • City level: city, region, sessions, avg duration, avg pages. "Back to Countries" link.
  • Paginated at both levels.

 

Bot Intelligence Report (visible only when "Show Bots" is ON):

  • Bot vs Human ratio bar (purple/green)
  • 4 KPI cards (bot sessions, human sessions, bot pageviews, human pageviews)
  • Bot table: name, sessions, total pages, avg pages/visit, first/last seen
  • Most Crawled Pages bar chart (purple bars)

 


7. Engagement Tab

Visitor quality scoring with 4 engagement tiers.

Tier Criteria Color
Bounced 1 page, then left Red
Browsers 2-3 pages viewed Orange
Engaged 4+ pages AND > 2 minutes Green
Power Users Logged in AND 10+ pages Purple

Display: 4 tier cards showing count, percentage, and description. Plus a stacked trend chart showing how the engagement distribution changes over time.


8. Content Tab

Content performance analytics with type switching.

Content Types: Videos | Models | Galleries | Cam Performers | Creators

Columns: ID, Title, Pageviews, Unique Views, Avg Time, Scroll Depth, All-Time Views

Data comes from joining tblAnalyticsPageViews (where contentid is set) with the respective content table for titles and all-time view counts.

Content Funnels (page 1 only):

  • Top Entry Pages (green bars) -- where visitors arrive
  • Top Exit Pages (red bars) -- where visitors leave
  • Page-to-Page Flows table -- top 20 from-page -> to-page transitions

 

Note: Content data requires the contentid field to be populated in tblAnalyticsPageViews. This is done automatically by includes/header.php which extracts the id parameter from the URL and by click.php which passes content type and ID. If contentid is NULL, items won't appear in this tab.

9. Search Tab

Search analytics from tblSearchHistory.

Search Type Distribution: KPI cards for each search type (universal, videos, galleries, models, performers, users)

Search Volume Trend: Line chart of daily searches vs zero-result searches.

Content Gaps (highlighted in orange): Zero-result searches sorted by frequency. These represent content that visitors want but can't find -- direct content creation opportunities.

Top Searches: Full table with query, type, search count, avg results. Zero-result rows highlighted yellow.

CSV Export: Download button on the searches table.


10. AI Insights Tab

AI-powered traffic analysis using the AIProviderClient class via the license server proxy. Disabled by default -- users must explicitly enable it since each analysis costs tokens.

Warning: AI Insights use tokens from the user's license account balance. Each analysis costs approximately 500-2,000 tokens depending on the data volume. The feature defaults to OFF and must be manually enabled.

When disabled: Shows an explanation card with an "Enable AI Insights" button and cost warning.

When enabled: Shows 5 insight cards, each with:

  • Run Analysis / Refresh button
  • Last run timestamp and token count (if cached result exists)
  • Cached result displayed as formatted markdown

 

Insight Types:

Type What AI Analyzes Output
Traffic Digest Sessions, visitors, bounce rate, top pages, referrers Natural language summary + 3-5 actionable recommendations
Anomaly Detection Daily session counts over the period Spikes, drops, pattern changes with suggested causes
Content Recommendations Top searches + zero-result searches + page performance Specific content to create, tags to add, prioritized by demand
SEO Suggestions Landing pages, bounce rates, referrer data Page-specific title/meta/linking improvements
Audience Personas Device, geo, time-of-day, content preferences 3-4 named personas with behavioral profiles

Caching: Results are stored in tblAITrafficInsights and persist across page reloads. The cached result is shown until the user clicks "Refresh" to re-run the analysis.


Bot Filtering

The dashboard excludes bot traffic by default. A "Show Bots" checkbox next to the period selector toggles bot inclusion.

Detected bots include: Facebook Crawler, Googlebot, Bingbot, YandexBot, AhrefsBot, SemrushBot, SE Ranking, GPTBot, ClaudeBot, Amazonbot, Archive.org, SeznamBot, TerraCotta, Twitterbot, DuckDuckBot, Baiduspider, MJ12bot, PetalBot, Bytespider, DataForSEO, Applebot, LinkedInBot, Pinterest, plus tool clients (curl, Ruby, Python, Go HTTP, Java, Wget, Node.js, Postman, OkHttp, Perl LWP, PHP, Scrapy).

Bot detection is performed by the parseUserAgent() method in ct/api/v1/core/Analytics.php and stored in tblAnalyticsSessions.devicetype = 'bot'.


CSV Export

Export buttons appear on the following tabs:

  • Sessions -- Exports up to 10,000 sessions with all columns
  • Pages -- Exports page performance data
  • Sources -- Exports referrer data with metrics
  • Search -- Exports search queries with result counts
  • Geographic -- Export button on the geo drill-down table

 

Downloads are generated server-side as CSV and delivered via browser blob download.


Translation Keys

All UI text uses AdminLanguage with the trafficstats. key namespace. Approximately 200 translation keys are defined in ct/admin/lang/en.json under the trafficstats section, organized by:

trafficstats.pagetitle, trafficstats.breadcrumb.

  • trafficstats.period., trafficstats.tabs.
  • trafficstats.overview., trafficstats.realtime., trafficstats.sessions.
  • trafficstats.sessiondetail., trafficstats.sources., trafficstats.pages.
  • trafficstats.tech., trafficstats.filters., trafficstats.common.
  • trafficstats.heatmap., trafficstats.dayofweek., trafficstats.newvsreturning.
  • trafficstats.comparison., trafficstats.utm., trafficstats.sourcetypes.
  • trafficstats.engagement., trafficstats.content., trafficstats.funnels.
  • trafficstats.search., trafficstats.ai.
  • trafficstats.demographics., trafficstats.geo., trafficstats.languages.
  • trafficstats.botreport., trafficstats.export.

 

Troubleshooting

Issue Cause Solution
"An error occurred" on 30/90 day Query timeout on large datasets Add idxfingerprint index; increase maxexecutiontime
All sessions show as "Unknown" OS/browser Bot traffic not classified Run backfillbots.php to reclassify existing sessions
Countries all "Unknown" GeoIP not resolving Check that ip-api.com is reachable from server; timezone events need analytics-tracker.js loaded
Content tab empty contentid not being set Verify includes/header.php includes contentid extraction and pages pass ?id= parameters
Search tab empty No searches recorded Verify frontend search uses the API (SearchController) which calls saveSearchHistory()
Scroll depth / time on page always 0% Events not writing back to pageviews Verify ct/api/v1/analytics/event.php has the pageexit, timeonpage, and scroll handlers
AI Insights disappear on refresh Cache not loading Verify tblAITrafficInsights table exists and has data; check browser console for errors
AI Insights shows "disabled" Toggle off Click "Enable AI Insights" button or set tblSettings.aitraffic_insights = 1
Bot report not showing "Show Bots" toggle off Enable the "Show Bots" checkbox next to the period selector

Revision History

Date Version Changes
2026-03-27 1.0.0 Initial creation with 9 tabs + AI Insights