@extends('layouts.dashboard') @section('title', 'Detail Analistik: ' . ($shortlink->custom_alias ?: $shortlink->short_code) . ' - Selinku') @section('content')

Detail Analistik

Laporan lengkap untuk link {{ $shortlink->custom_alias ?: $shortlink->short_code }}

Laporan Aktivitas Link

Update: {{ now()->format('H:i') }}
Total Trafik {{ number_format($shortlink->clicks->count()) }} Data total sepanjang masa
Unik {{ number_format($shortlink->clicks->where('is_unique', true)->count()) }} Pengunjung baru
Hari Ini
{{ number_format($shortlink->clicks->where('clicked_at', '>=', today())->count()) }} @if($shortlink->clicks->where('clicked_at', '>=', today())->count() > 0) Live @endif
Sejak 00:00
Minggu Ini {{ number_format($shortlink->clicks->where('clicked_at', '>=', now()->subDays(6))->count()) }} 7 hari terakhir

Tren Klik (30 Hari)

Sumber Trafik Teratas

Data 30 hari terakhir
@forelse($referrers as $ref)
{{ $ref->referer_domain ?: 'Direct / Unknown' }} @if($ref->referer_url) {{ $ref->referer_url }} @endif
{{ number_format($ref->total) }}
@empty
Belum ada data referer
@endforelse

Statistik Populer (Sepanjang Masa)

Perangkat
@php $topDeviceType = $devices->first() ? strtolower($devices->first()->device_type) : 'desktop'; $deviceIconClass = 'fa-desktop'; if ($topDeviceType === 'mobile') $deviceIconClass = 'fa-mobile-alt'; elseif ($topDeviceType === 'tablet') $deviceIconClass = 'fa-tablet-alt'; @endphp
{{ $devices->first() ? $devices->first()->device_type : '-' }}
{{ $devices->first() ? number_format($devices->first()->total) . ' Klik' : '0 Klik' }}
Sistem Operasi
@php $topOsName = $os_stats->first() ? strtolower($os_stats->first()->os) : ''; $osIconClass = 'fa-solid fa-microchip'; if (str_contains($topOsName, 'windows')) $osIconClass = 'fa-brands fa-windows'; elseif (str_contains($topOsName, 'android')) $osIconClass = 'fa-brands fa-android'; elseif (str_contains($topOsName, 'linux')) $osIconClass = 'fa-brands fa-linux'; elseif (str_contains($topOsName, 'ios') || str_contains($topOsName, 'mac')) $osIconClass = 'fa-brands fa-apple'; elseif (str_contains($topOsName, 'ubuntu')) $osIconClass = 'fa-brands fa-ubuntu'; @endphp
{{ $os_stats->first() ? $os_stats->first()->os : '-' }}
{{ $os_stats->first() ? number_format($os_stats->first()->total) . ' Klik' : '0 Klik' }}
Negara
{{ $countries->first() ? $countries->first()->country : '-' }}
{{ $countries->first() ? number_format($countries->first()->total) . ' Klik' : '0 Klik' }}
Kota
{{ $cities->first() ? $cities->first()->city : '-' }}
{{ $cities->first() ? number_format($cities->first()->total) . ' Klik' : '0 Klik' }}
{{ $periodLabel }}, link Anda banyak diakses melalui {{ $dominant7Days['source'] }}, dengan perangkat {{ $dominant7Days['device'] }}, dari {{ $dominant7Days['city'] }}, {{ $dominant7Days['country'] }}.
@if(!empty($insights))
@if(isset($insights['os']))
{!! $insights['os'] !!}
@endif @if(isset($insights['device']))
{!! $insights['device'] !!}
@endif @if(isset($insights['location']))
{!! $insights['location'] !!}
@endif @if(isset($insights['peak_time']))
{!! $insights['peak_time'] !!}
@endif
@endif
Terakhir diklik: {{ $lastClick }}
@if($clicks1Hour > 0)
Klik dalam 1 jam terakhir: {{ $clicks1Hour }} kali
@endif

Klik Terbaru

@if(request('q')) @endif
@forelse($clickHistory as $click)
{{ $click->clicked_at->translatedFormat('d M Y, H:i') }}
{{ $click->ip_address }}
Sumber @if($click->referer_url)
{{ parse_url($click->referer_url, PHP_URL_HOST) ?? 'Unknown' }}
@else
Direct / Email / SMS
@endif
Perangkat {{ $click->device_type }}
Lokasi {{ $click->city && $click->city !== 'Unknown' ? $click->city : ($click->country ?: 'Unknown') }}
@empty
Belum ada data klik terbaru.
@endforelse
@if($clickHistory->hasPages())
{{ $clickHistory->links() }}
@endif
@push('scripts') @endpush @endsection