Cohort Retention

@php $retentionData = $this->getCohortRetentionData(); $cohorts = $retentionData['cohorts'] ?? []; $maxMonths = $retentionData['maxMonths'] ?? 0; @endphp @if(empty($cohorts))

No cohort retention data available

@else
@for($i = 0; $i < $maxMonths; $i++) @endfor @foreach($cohorts as $index => $cohort) {{-- Cohort Month --}} {{-- Cohort Size --}} {{-- Retention Months (M0, M1, M2, ...) --}} @for($i = 0; $i < $maxMonths; $i++) @php $monthKey = "M{$i}"; $retention = $cohort['retention'][$monthKey] ?? null; $percentage = $retention ? $retention['percentage'] : null; $count = $retention ? $retention['count'] : 0; @endphp @endfor @endforeach
Cohort SizeM{{ $i }}
{{ \Carbon\Carbon::parse($cohort['cohort_month'])->format('M Y') }} {{ number_format($cohort['cohort_size']) }} @if($percentage !== null)
{{ number_format($percentage, 1) }}% ({{ $count }})
@else - @endif
{{-- Legend/Info --}}
≥80% Retention
50-79% Retention
<50% Retention
M0 = Signup Month, M1+ = Subsequent Months
@endif