@extends('backend.layouts.app') @section('title', \App\Http\Helpers\MenuHelper::getPageTitle()) @section('content') @include('backend.module._index-reset-button') @php $pageTitle = \App\Http\Helpers\MenuHelper::getPageTitle(); $isVisitors = $activeTab === 'visitors'; $isPageViews = $activeTab === 'pageviews'; $isReport = $activeTab === 'report'; $today = now()->startOfDay(); $periodDateCarbon = \Illuminate\Support\Carbon::parse($periodDate); $rangeSummary = \Illuminate\Support\Carbon::parse($dateFrom)->format('d M Y').' – '.\Illuminate\Support\Carbon::parse($dateTo)->format('d M Y'); $siteSummary = $site !== '' ? ($siteLabels[$site] ?? $site) : 'All sites'; $reportQuery = array_filter([ 'site' => $site, 'report_year' => $report['year'], 'report_month' => $report['month'], ], fn ($value) => $value !== '' && $value !== null); $activeQuickRange = match (true) { $period === 'day' && $periodDateCarbon->isToday() => 'day', $period === 'week' && $periodDateCarbon->betweenIncluded( $today->copy()->startOfWeek(\Illuminate\Support\Carbon::MONDAY), $today->copy()->endOfWeek(\Illuminate\Support\Carbon::SUNDAY) ) => 'week', $period === 'month' && $periodDateCarbon->isSameMonth($today) => 'month', $period === 'year' && $periodDateCarbon->isSameYear($today) => 'year', $period === '' && $dateFrom === $today->copy()->startOfMonth()->toDateString() && $dateTo === $today->toDateString() => 'month', $period === '' && $dateFrom === $today->copy()->subDays(6)->toDateString() => '7', $period === '' && $dateFrom === $today->copy()->subDays(29)->toDateString() => '30', default => '', }; $quickRanges = [ ['key' => 'day', 'label' => 'Today'], ['key' => 'week', 'label' => 'This week'], ['key' => 'month', 'label' => 'This month'], ['key' => 'year', 'label' => 'This year'], ['key' => '7', 'label' => 'Last 7 days'], ['key' => '30', 'label' => 'Last 30 days'], ]; $visitorMetrics = [ ['label' => 'Daily visits', 'value' => $dailyVisitors, 'note' => $setting->is_active ? 'One count per visitor and site each day' : 'Daily visitor counter is paused', 'icon' => 'M16 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2m16 0v-2a4 4 0 0 0-3-3.87M14 3.13a4 4 0 0 1 0 7.75M14 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z', 'color_classes' => 'bg-violet-50 text-violet-600 dark:bg-violet-500/10 dark:text-violet-300'], ['label' => 'Unique visitors', 'value' => $uniqueVisitors, 'note' => $setting->is_active ? 'Distinct visitors in range' : ($setting->is_page_view_active ? 'Based on page-view data' : 'Both counters are paused'), 'icon' => 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm7 9a7 7 0 0 0-14 0', 'color_classes' => 'bg-blue-50 text-blue-600 dark:bg-blue-500/10 dark:text-blue-300'], ]; $pageViewMetrics = [ ['label' => 'Page views', 'value' => $pageViews, 'note' => $setting->is_page_view_active ? 'Deduplicated over 30 minutes' : 'Page-view tracking is paused', 'icon' => 'M3 3v18h18M7 14l4-4 4 4 6-7', 'color_classes' => 'bg-sky-50 text-sky-600 dark:bg-sky-500/10 dark:text-sky-300'], ['label' => 'Pages visited', 'value' => $pageCount, 'note' => $setting->is_page_view_active ? 'Distinct site pages' : 'Page-view tracking is paused', 'icon' => 'M4 4h16v16H4zM8 8h8m-8 4h8m-8 4h5', 'color_classes' => 'bg-amber-50 text-amber-600 dark:bg-amber-500/10 dark:text-amber-300'], ]; $fieldLabelClasses = 'mb-1.5 block text-sm font-medium text-gray-700 dark:text-gray-400'; $selectClasses = 'shadow-theme-xs h-11 w-full appearance-none rounded-lg border border-gray-300 bg-transparent py-2.5 pr-10 pl-4 text-sm text-gray-800 transition focus:border-brand-300 focus:ring-3 focus:ring-brand-500/10 focus:outline-hidden dark:border-gray-700 dark:bg-gray-900 dark:text-white/90'; // Date fields follow the Content Article date input styling (custom calendar icon + showPicker). $dateClasses = 'dark:bg-dark-900 shadow-theme-xs focus:border-brand-300 focus:ring-brand-500/10 dark:focus:border-brand-800 h-11 w-full appearance-none rounded-lg border border-gray-300 bg-transparent bg-none py-2.5 pr-11 pl-4 text-sm text-gray-800 placeholder:text-gray-400 transition focus:ring-3 focus:outline-hidden disabled:cursor-not-allowed disabled:opacity-60 dark:border-gray-700 dark:bg-gray-900 dark:text-white/90 dark:placeholder:text-white/30'; $quickActiveClasses = 'border-violet-300 bg-violet-50 text-violet-700 shadow-theme-xs dark:border-violet-500/40 dark:bg-violet-500/10 dark:text-violet-300'; $quickInactiveClasses = 'border-gray-200 bg-white text-gray-600 hover:border-gray-300 hover:bg-gray-50 dark:border-gray-700 dark:bg-transparent dark:text-gray-300 dark:hover:bg-white/[0.04]'; @endphp

Traffic overview

{{ $pageTitle }}

Understand who visits, what they read, and how traffic changes over time.

@endsection