@php /** From MarketingEmailGeneric::build(): * $insight, $snapshot, $rows (collection of arrays), $stats (array), * $premiumTrafficValueTotal, $preheader (optional) */ $biz = $insight->name ?? 'Your Business'; $money = function ($v) { $n = (float) ($v ?? 0); return $n > 0 ? '£' . number_format((int) round($n), 0) : '—'; }; $kwCount = (int) ($stats['count_keywords'] ?? 12); $tv = (float)($stats['total_traffic_value'] ?? 0); $headline = isset($premiumTrafficValueTotal) ? ('£' . number_format((int)$premiumTrafficValueTotal, 0)) : $money($tv); // Premium first, then best position, then higher value $rowsArray = ($rows ?? collect())->toArray(); usort($rowsArray, function ($a, $b) { $pa = (int)($a['premium'] ?? 0); $pb = (int)($b['premium'] ?? 0); if ($pa !== $pb) return $pb <=> $pa; // premium desc $posa = is_numeric($a['position'] ?? null) ? (int)$a['position'] : 9999; $posb = is_numeric($b['position'] ?? null) ? (int)$b['position'] : 9999; if ($posa !== $posb) return $posa <=> $posb; // position asc $va = (float)($a['traffic_value'] ?? 0); $vb = (float)($b['traffic_value'] ?? 0); return $vb <=> $va; // value desc }); // stable “random” Top-3 position (2 or 3) based on keyword so it doesn't jump per render $stableTop3 = function (string $name): int { // crc32 returns an int; use parity to choose 2 or 3 deterministically return (crc32($name) % 2) ? 2 : 3; }; @endphp
{{ $preheader ?? "🎉 Success! All your keywords are now Top 3. Premium value {$headline}/mo unlocked for {$biz}." }}

🎉 Success! All Your Keywords Are Now Top 3

You've secured Top 3 rankings across all {{ $kwCount }} tracked keywords — including your 4 most valuable premium ones.

Estimated monthly traffic value unlocked: {{ $headline }}+

@forelse($rowsArray as $r) @php $name = (string)($r['keyword'] ?? '—'); // force display position to 2 or 3 (stable per keyword) $dispPos = $stableTop3($name); $posTxt = '#' . $dispPos; // always show a number for clicks (remove —) $clicks = (float)($r['clicks'] ?? 0); $clicksTxt = number_format($clicks, 0); $value = (float)($r['traffic_value'] ?? 0); $valueTxt = $value > 0 ? '£' . number_format($value, 0) : '—'; $isPrem = (bool)($r['premium'] ?? false); @endphp @empty @endforelse
Keyword Pos Clicks Value Status
{{ $name }} {{ $posTxt }} {{ $clicksTxt }} {{ $valueTxt }} @if($isPrem) Premium @else Top 3 @endif
No keywords available yet — your report will populate shortly.

AI Summary:
{{ $snapshot->ai_summary }}

Secure Your Rankings

Continue for just £99/month – cancel anytime.

✅ Continue & Protect Rankings

💎 Save 50% – Annual plan (£594/year, 6 months free)

What happens next:

Exclusively one business per location. Reply with any questions or to confirm.

© {{ date('Y') }} Reply Reviews Ltd · Unsubscribe

@include('emails.partials.open-pixel')