@php /** @var array{clicks:int,impressions:int,ctr:float,position:float}|array{} $traffic */ /** @var array|array{} $recommendations */ /** @var array|array{} $alerts */ /** @var array{applied_count?:int,total_clicks_lift?:int,pages_improved?:int}|array{} $roi */ /** @var array|array{} $tasks */ /** @var array|array{} $quickWins */ /** @var array|array{} $contentAging */ /** @var string $siteName */ /** @var int $findingsCount */ /** @var int $pendingActionsCount */ /** @var string $analysisUrl */ /** @var string $unsubscribeUrl */ /** @var string $weekLabel */ /** @var string $greetingName */ $actionTypeLabels = [ 'content_rewrite' => 'Rewrite', 'meta_tag' => 'Meta tag', 'meta_tag_optimization' => 'Meta tag', 'internal_linking' => 'Internal links', 'thin_content' => 'Thin content', 'freshness' => 'Refresh', 'noindex' => 'Noindex', 'eeat' => 'E-E-A-T', 'geo' => 'GEO', ]; $fmt = fn ($n) => number_format((float) $n); $fmt1 = fn ($n) => number_format((float) $n, 1); $fmt2 = fn ($n) => number_format((float) $n, 2); // Defensive defaults — keeps the template safe to call from preview routes // and handles older notification payloads that may omit newer fields. $tasks = $tasks ?? []; $contentAging = $contentAging ?? []; $alerts = $alerts ?? []; $quickWins = $quickWins ?? []; $recommendations = $recommendations ?? []; $roi = $roi ?? []; $traffic = $traffic ?? []; // Pre-resolve the heading + lede so we don't have to play HTML-entity tricks // inside attribute values (which are fragile across email clients). $heading = 'Snapshot for '.e($siteName).''; $lede = 'Hi '.e($greetingName).' — ' .(int) $findingsCount.' new findings, ' .(int) $pendingActionsCount.' pending actions. ' .'The numbers below are pulled directly from Google Search Console.'; @endphp {{-- KPI ROW (cellspacing for Outlook gutter, border-spacing for everyone else) --}} @if (! empty($traffic)) @endif {{-- TOP RECOMMENDATIONS --}} @if (! empty($recommendations))

Top recommendations

@foreach (array_slice($recommendations, 0, 5) as $rec) @php $type = $rec['action_type'] ?? 'recommendation'; $typeLabel = $actionTypeLabels[$type] ?? ucfirst(str_replace('_', ' ', $type)); @endphp @endforeach
Type Recommendation Impact
{{ $typeLabel }} {{ $rec['title'] ?? 'Recommendation' }} {{ (int) ($rec['impact_score'] ?? 0) }}
@endif {{-- TRAFFIC ALERTS --}} @if (! empty($alerts))

Traffic alerts

@foreach (array_slice($alerts, 0, 4) as $alert) @php $severity = strtolower($alert['severity'] ?? 'info'); $dotColor = match ($severity) { 'critical', 'error' => '#dc2626', 'warning' => '#f59e0b', default => '#16a34a' }; $anomalyLabel = ucwords(str_replace('_', ' ', (string) ($alert['anomaly_type'] ?? 'anomaly'))); $changePct = $alert['metrics']['change_percent'] ?? null; $rawUrl = (string) ($alert['page_url'] ?? ''); $cleanUrl = $rawUrl ? (parse_url($rawUrl, PHP_URL_HOST) ?? '').(parse_url($rawUrl, PHP_URL_PATH) ?? '') : ''; @endphp @endforeach

 {{ strtoupper($severity) }} · {{ $anomalyLabel }}

{{ $cleanUrl ?: 'Unknown page' }} @if ($changePct !== null) {{ ($changePct >= 0 ? '+' : '').number_format((float) $changePct, 1) }}% @endif

 
@endif {{-- UPCOMING TASKS --}} @if (! empty($tasks)) @php $taskCount = count($tasks); $taskWord = $taskCount === 1 ? 'task' : 'tasks'; @endphp

Upcoming SEO Tasks ({{ $taskCount }} {{ $taskWord }})

@foreach (array_slice($tasks, 0, 5) as $task) @php try { $due = \Carbon\Carbon::parse($task['due_date'] ?? '')->format('M j, Y'); } catch (\Throwable) { $due = (string) ($task['due_date'] ?? '—'); } @endphp @endforeach
{{ $task['title'] ?? 'Untitled task' }} Due: {{ $due }}
@endif {{-- QUICK WINS --}} @if (! empty($quickWins))

Quick wins · ~15 min each

@foreach (array_slice($quickWins, 0, 3) as $win) @php $type = $win['action_type'] ?? 'recommendation'; $typeLabel = $actionTypeLabels[$type] ?? ucfirst(str_replace('_', ' ', $type)); @endphp @endforeach
{{ $typeLabel }} {{ $win['title'] ?? 'Recommendation' }} {{ (int) ($win['impact_score'] ?? 0) }}
@endif {{-- CONTENT AGING --}} @if (! empty($contentAging))

Content aging

@foreach (array_slice($contentAging, 0, 5) as $aging) @php $rawAgingUrl = (string) ($aging['page_url'] ?? ''); $cleanAgingUrl = $rawAgingUrl ? (parse_url($rawAgingUrl, PHP_URL_HOST) ?? '').(parse_url($rawAgingUrl, PHP_URL_PATH) ?? '') : 'Page'; @endphp @endforeach
{{ $cleanAgingUrl }} {{ (int) ($aging['priority_score'] ?? 0) }}
@endif {{-- YOUR IMPACT --}} @if (! empty($roi) && (int) ($roi['applied_count'] ?? 0) > 0)

Your impact this week

You applied {{ (int) ($roi['applied_count'] ?? 0) }} recommendations. Result: +{{ $fmt($roi['total_clicks_lift'] ?? 0) }} clicks lift across {{ (int) ($roi['pages_improved'] ?? 0) }} improved pages.

@endif {{-- CTA --}} View full analysis {{-- SUBCOPY --}}

Numbers above are pulled directly from Google Search Console — no estimates, no rounding. Manage email preferences.