@php $n = fn ($v, $d = 0) => $v === null ? null : number_format($v, $d); $pct = function ($v) { if ($v === null) return ''; return ''.($v >= 0 ? '+' : '').$v.'%'; }; $cell = function ($row, $m, $dec = 0, $fmt = null) use ($n, $pct) { $state = in_array($m, ['clicks','impressions','ctr','position']) ? $row['gsc_state'] : $row['ga4_state']; if ($row[$m] === null) { return '—'; } $v = $fmt ? $fmt($row[$m]) : $n($row[$m], $dec); $chg = $m === 'position' ? '' : $pct($row['pct_'.$m]); if ($m === 'position' && $row['chg_position'] !== null) { $chg = ''.sprintf('%+.1f', $row['chg_position']).''; } $prev = $row['prev_'.$m] === null ? 'previous month: no data' : 'previous month: '.($fmt ? $fmt($row['prev_'.$m]) : $n($row['prev_'.$m], $dec)); return ''.$v.' '.$chg.''; }; $sortHead = fn ($col, $label) => ''; @endphp
| Event | Organic | Other channels | Total | Organic {{ $leads['prev_month'] }} | Change | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| {{ $e['label'] }} | @if($e['total'] === null){{ $leads['connected'] ? 'Not tracked for this period (tracking started '.($leads['tracking_since'] ?? 'not yet').')' : 'GA4 not connected' }} | @else{{ number_format($e['organic']) }} | {{ number_format($e['other']) }} | {{ number_format($e['total']) }} | {{ $e['prev_organic'] === null ? 'no data' : number_format($e['prev_organic']) }} | {!! $e['pct_organic'] === null ? 'n/a' : $pct($e['pct_organic']) !!} | @endif||||
Only "Confirmed form inquiries" are leads. WhatsApp and phone clicks show intent — they are not confirmed conversations or calls.
| {!! $sortHead('name', 'Page / product') !!} | {!! $sortHead('page_type', 'Type') !!} | {!! $sortHead('views', 'Views') !!} | {!! $sortHead('users', 'Users') !!} | {!! $sortHead('sessions', 'Sessions*') !!} | {!! $sortHead('organic_sessions', 'Organic sess.') !!} | {!! $sortHead('landing_sessions', 'Landing sess.') !!} | {!! $sortHead('avg_engagement', 'Eng. time') !!} | {!! $sortHead('bounce_rate', 'Bounce') !!} | {!! $sortHead('form_leads', 'Form leads') !!} | {!! $sortHead('whatsapp_clicks', 'WA clicks') !!} | {!! $sortHead('phone_clicks', 'Tel clicks') !!} | {!! $sortHead('clicks', 'GSC clicks') !!} | {!! $sortHead('impressions', 'Impr.') !!} | {!! $sortHead('ctr', 'CTR') !!} | {!! $sortHead('position', 'Pos.') !!} | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ \Illuminate\Support\Str::limit($r['name'], 60) }} {{ $r['key'] }}@if($r['sku']) · SKU {{ $r['sku'] }}@endif @if(! $r['in_crawl']) · not in last crawl @endif |
{{ $r['page_type'] }} | @php($gaMsg = ['no_data' => 'No recorded data in GA4 for this page', 'unavailable' => 'GA4 data unavailable for this period', 'not_connected' => 'GA4 not connected'][$r['ga4_state']] ?? null) @php($gsMsg = ['no_data' => 'No recorded data in Search Console', 'unavailable' => 'Search Console unavailable', 'not_connected' => 'Search Console not connected'][$r['gsc_state']] ?? null) @if($gaMsg){{ $gaMsg }} | @else{!! $cell($r, 'views') !!} | {!! $cell($r, 'users') !!} | {!! $cell($r, 'sessions') !!} | {!! $cell($r, 'organic_sessions') !!} | {!! $cell($r, 'landing_sessions') !!} | {!! $cell($r, 'avg_engagement', 0, fn ($v) => round($v).'s') !!} | {!! $cell($r, 'bounce_rate', 0, fn ($v) => round($v * 100).'%') !!} | {!! $cell($r, 'form_leads') !!} | {!! $cell($r, 'whatsapp_clicks') !!} | {!! $cell($r, 'phone_clicks') !!} | @endif @if($gsMsg){{ $gsMsg }} | @else{!! $cell($r, 'clicks') !!} | {!! $cell($r, 'impressions') !!} | {!! $cell($r, 'ctr', 0, fn ($v) => round($v * 100, 1).'%') !!} | {!! $cell($r, 'position', 1) !!} | @endif||||||||||||