@extends('layouts.app') @section('title', _lang('Website Visitors')) @section('content')
@include('partials.alerts')

{{ _lang('Website Visitors') }}

{{ _lang('Anonymous visitors on your public website') }}

{{-- Legend --}}
ভিজিট — মোট পেজ লোড (একজন ব্যক্তি ৫টি পেজ দেখলে = ৫ ভিজিট) ভিজিটর — অনন্য দর্শক (একই ব্যক্তি = ১ ভিজিটর, যত পেজই দেখুক)
{{-- KPI tiles --}} @php $cards = [['আজ', $kpi['today']], ['৭ দিন', $kpi['d7']], ['৩০ দিন', $kpi['d30']], ['সর্বমোট', $kpi['all']]]; @endphp
@foreach ($cards as [$label, $v])
{{ $label }}
ভিজিট
{{ number_format($v['visits']) }}
ভিজিটর
{{ number_format($v['uniques']) }}
@endforeach
{{-- Daily traffic chart (ApexCharts area) --}} @php $chartLabels = collect($daily)->map(fn ($d) => \Illuminate\Support\Carbon::parse($d->date)->format('d M'))->values(); $chartVisits = collect($daily)->map(fn ($d) => (int) $d->visits)->values(); $chartUniques = collect($daily)->map(fn ($d) => (int) $d->uniques)->values(); @endphp
{{ _lang('Daily traffic') }} {{ _lang('last 30 days') }}
{{-- Top pages --}}
{{ _lang('Top pages') }} {{ _lang('30 days') }}
@php($pMax = max(1, optional($topPages->first())->count ?? 1)) @forelse ($topPages as $p)
{{ $p->label }}{{ number_format($p->count) }}
@empty
{{ _lang('No data yet.') }}
@endforelse
{{-- Top sources --}}
{{ _lang('Where visitors come from') }} {{ _lang('30 days') }}
@php($rMax = max(1, optional($topReferers->first())->count ?? 1)) @forelse ($topReferers as $r)
{{ $r->label }}{{ number_format($r->count) }}
@empty
{{ _lang('Mostly direct visits (typed the address or a bookmark).') }}
@endforelse
{{-- Devices --}}
{{ _lang('Devices') }}
@forelse ($devices as $d)
{{ $d->label }}{{ number_format($d->count) }}
@empty
@endforelse
{{-- Browsers --}}
{{ _lang('Browsers') }}
@forelse ($browsers as $b)
{{ $b->label }}{{ number_format($b->count) }}
@empty
@endforelse
{{-- Recent visits --}}
{{ _lang('Recent visits') }}
@forelse ($recent as $v) @empty @endforelse
{{ _lang('Page') }} {{ _lang('Device') }} {{ _lang('Source') }} {{ _lang('When') }}
{{ $v->path }} {{ $v->device }} · {{ $v->browser }} {{ $v->referer ?: '—' }} {{ $v->created_at?->diffForHumans() }}
{{ _lang('No visits recorded yet.') }}
@push('scripts') @endpush @endsection