<?php  if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } $traffic = Database::fetchAll( "SELECT DATE(ch.hit_at) as day, cd.campaign_name, COUNT(*) as hits      FROM campaign_hits ch      JOIN stores cd ON cd.id = ch.domain_id      WHERE ch.hit_at > DATE_SUB(NOW(), INTERVAL 30 DAY)      GROUP BY day, cd.campaign_name ORDER BY day DESC" ); echo "<div class=\"traffic-nexus\"><h3>Traffic Nexus — 30 Day Flow</h3>"; $headers = ["Date", "Campaign", "Hits"]; $rows = []; foreach ($traffic as $t) { $rows[] = [$t["day"], UI::e($t["campaign_name"] ?? "direct"), $t["hits"]]; } echo UI::table($headers, $rows, "tbl-traffic") . "</div>"; 