Agency Case Results
Cuerpo del caso: reto, enfoque numerado, tabla de métricas antes/después, gráfico SVG de 12 meses y cita del cliente.
case-studyresultschartagency
Vista Previa en Vivo
The challenge
Rising CPMs, a single hero ad that had fatigued and tracking that missed 30% of purchases after iOS changes.
What we did
- Server-side tracking with Conversions API recovered the missing purchase data.
- A simple three-campaign structure with broad audiences.
- Twelve new creatives every two weeks, led by founder and customer videos.
| Metric | Before | After | Change |
|---|---|---|---|
| ROAS | 2.1× | 6.2× | +195% |
| Monthly revenue from ads | €42k | €188k | +348% |
| Cost per purchase | €38 | €19 | −50% |
M1M12
| M1 | 42 |
|---|---|
| M2 | 48 |
| M3 | 55 |
| M4 | 61 |
| M5 | 78 |
| M6 | 92 |
| M7 | 104 |
| M8 | 118 |
| M9 | 131 |
| M10 | 149 |
| M11 | 166 |
| M12 | 188 |
“Volta treated our ad budget like their own money. We tripled revenue without tripling spend.”
Uso
Copia y pega este código directamente en tu componente React:
tsx
import { AgencyCaseResults } from 'react-component-kit-ui/sections';
<AgencyCaseResults challenge="Tracking missed 30% of sales." metrics={[{ label: 'ROAS', before: '2.1×', after: '6.2×', change: '+195%' }]} series={[42, 61, 92, 131, 188]} />Instalación Manual
Si no estás usando el paquete npm, crea un archivo nuevo y pega el siguiente código: src/components/sections/AgencyCaseResults.tsx + AgencyCaseResults.css:
AgencyCaseResults.tsx
'use client';
import { useId } from 'react';
import './AgencyCaseResults.css';
/** class:list → className */
function cx(...args: unknown[]): string {
const out: string[] = [];
const walk = (v: unknown) => {
if (!v) return;
if (typeof v === 'string' || typeof v === 'number') out.push(String(v));
else if (Array.isArray(v)) v.forEach(walk);
else if (typeof v === 'object') for (const [k, on] of Object.entries(v as Record<string, unknown>)) if (on) out.push(k);
};
args.forEach(walk);
return out.join(' ');
}
/**
* AgencyCaseResults — Body of a case study: the challenge, the numbered approach, a before/after
* metrics table, a 12-month results chart (SVG area line, no dependencies) and the client quote.
*
* @param {string} challengeTitle - Heading for the challenge. Default 'The challenge'.
* @param {string} challenge - Challenge text.
* @param {string} approachTitle - Heading for the approach. Default 'What we did'.
* @param {string[]} approach - Steps taken.
* @param {Array<{label: string, before: string, after: string, change: string}>} metrics - Before/after rows.
* @param {number[]} series - Values for the chart (e.g. 12 months).
* @param {string} seriesLabel - Chart caption. Default 'Revenue from ads (€k / month)'.
* @param {string[]} periods - X labels (defaults to M1…Mn).
* @param {{quote: string, name: string, role: string, company: string}} quote - Client quote (optional).
* @param {string} className - Extra class.
*
* Accessibility: real <table> for metrics; the chart is a figure with a text summary (first,
* last and change) and a visually hidden data table.
*/
export interface AgencyCaseResultsProps {
challengeTitle?: string;
challenge?: string;
approachTitle?: string;
approach?: string[];
metrics?: Array<{ label: string; before: string; after: string; change: string }>;
series?: number[];
seriesLabel?: string;
periods?: string[];
quote?: { quote: string; name: string; role: string; company: string };
className?: string;
}
export function AgencyCaseResults({
challengeTitle = 'The challenge',
challenge = 'Rising CPMs, a single hero ad that had fatigued and tracking that missed 30% of purchases after iOS changes.',
approachTitle = 'What we did',
approach = [
'Server-side tracking with Conversions API recovered the missing purchase data.',
'A simple three-campaign structure with broad audiences.',
'Twelve new creatives every two weeks, led by founder and customer videos.',
],
metrics = [
{ label: 'ROAS', before: '2.1×', after: '6.2×', change: '+195%' },
{ label: 'Monthly revenue from ads', before: '€42k', after: '€188k', change: '+348%' },
{ label: 'Cost per purchase', before: '€38', after: '€19', change: '−50%' },
],
series = [42, 48, 55, 61, 78, 92, 104, 118, 131, 149, 166, 188],
seriesLabel = 'Revenue from ads (€k / month)',
periods,
quote = { quote: 'Volta treated our ad budget like their own money. We tripled revenue without tripling spend.', name: 'Freja Lund', role: 'Co-founder', company: 'Nordlys' },
className = '',
}: AgencyCaseResultsProps) {
const labels = periods ?? series.map((_, i) => `M${i + 1}`);
const W = 600, H = 240, P = 8;
const max = Math.max(...series) * 1.08;
const min = Math.min(0, Math.min(...series));
const x = (i: number) => P + (i * (W - P * 2)) / Math.max(1, series.length - 1);
const y = (v: number) => H - P - ((v - min) / (max - min || 1)) * (H - P * 2);
const line = series.map((v, i) => `${i ? 'L' : 'M'}${x(i).toFixed(1)} ${y(v).toFixed(1)}`).join(' ');
const area = `${line} L${x(series.length - 1).toFixed(1)} ${H - P} L${x(0).toFixed(1)} ${H - P} Z`;
const first = series[0];
const last = series[series.length - 1];
const pct = first ? Math.round(((last - first) / Math.abs(first)) * 100) : 0;
const fmtV = (v: number) => (Number.isInteger(v) ? String(v) : v.toFixed(2));
const gid = `acr-g-${useId().replace(/[^a-zA-Z0-9]/g, '')}`;
return (
<>
<div className="acr-cq" data-rk-59ce98="">
<section className={cx(['acr', className])} data-rk-59ce98="">
<div className="acr__story" data-rk-59ce98="">
<div data-rk-59ce98="">
<h2 className="acr__h" data-rk-59ce98="">{challengeTitle}</h2>
<p className="acr__p" data-rk-59ce98="">{challenge}</p>
</div>
<div data-rk-59ce98="">
<h2 className="acr__h" data-rk-59ce98="">{approachTitle}</h2>
<ol className="acr__steps" data-rk-59ce98="">{approach.map((a, __i: number) => <li key={__i} data-rk-59ce98="">{a}</li>)}</ol>
</div>
</div>
<div className="acr__data" data-rk-59ce98="">
<table className="acr__table" data-rk-59ce98="">
<caption className="acr__h" data-rk-59ce98="">Results</caption>
<thead data-rk-59ce98=""><tr data-rk-59ce98=""><th scope="col" data-rk-59ce98="">Metric</th><th scope="col" data-rk-59ce98="">Before</th><th scope="col" data-rk-59ce98="">After</th><th scope="col" data-rk-59ce98="">Change</th></tr></thead>
<tbody data-rk-59ce98="">
{metrics.map((m, __i: number) => (
<tr key={__i} data-rk-59ce98=""><th scope="row" data-rk-59ce98="">{m.label}</th><td data-rk-59ce98="">{m.before}</td><td data-rk-59ce98=""><strong data-rk-59ce98="">{m.after}</strong></td><td data-rk-59ce98=""><span className="acr__chg" data-rk-59ce98="">{m.change}</span></td></tr>
))}
</tbody>
</table>
<figure className="acr__chart" data-rk-59ce98="">
<figcaption data-rk-59ce98="">
<span data-rk-59ce98="">{seriesLabel}</span>
<strong data-rk-59ce98="">{pct >= 0 ? '+' : ''}{pct}%</strong>
</figcaption>
<svg viewBox={`0 0 ${W} ${H}`} role="img" aria-label={`${seriesLabel}: from ${fmtV(first)} to ${fmtV(last)} over ${series.length} periods (${pct >= 0 ? '+' : ''}${pct}%).`} data-rk-59ce98="">
<defs data-rk-59ce98="">
<linearGradient id={gid} x1="0" y1="0" x2="0" y2="1" data-rk-59ce98="">
<stop offset="0%" style={{ stopColor: "var(--agency-accent, var(--c-primary-light, #d4a017))", stopOpacity: "0.45" }} data-rk-59ce98="" />
<stop offset="100%" style={{ stopColor: "var(--agency-accent, var(--c-primary-light, #d4a017))", stopOpacity: "0" }} data-rk-59ce98="" />
</linearGradient>
</defs>
{[0.25, 0.5, 0.75].map((f, __i: number) => <line key={__i} x1="0" x2={W} y1={H * f} y2={H * f} className="acr__grid" data-rk-59ce98="" />)}
<path d={area} fill={`url(#${gid})`} data-rk-59ce98="" />
<path d={line} className="acr__line" pathLength="1" data-rk-59ce98="" />
<circle cx={x(series.length - 1)} cy={y(last)} r="6" className="acr__dot" data-rk-59ce98="" />
</svg>
<div className="acr__axis" aria-hidden="true" data-rk-59ce98=""><span data-rk-59ce98="">{labels[0]}</span><span data-rk-59ce98="">{labels[labels.length - 1]}</span></div>
<table className="sr-only" data-rk-59ce98="">
<caption data-rk-59ce98="">{seriesLabel}</caption>
<tbody data-rk-59ce98="">{series.map((v, i) => <tr key={i} data-rk-59ce98=""><th scope="row" data-rk-59ce98="">{labels[i]}</th><td data-rk-59ce98="">{fmtV(v)}</td></tr>)}</tbody>
</table>
</figure>
</div>
{quote && (
<figure className="acr__quote" data-rk-59ce98="">
<blockquote data-rk-59ce98=""><p data-rk-59ce98="">“{quote.quote}”</p></blockquote>
<figcaption data-rk-59ce98=""><strong data-rk-59ce98="">{quote.name}</strong> — {quote.role}, {quote.company}</figcaption>
</figure>
)}
</section>
</div>
</>
);
}
export default AgencyCaseResults;AgencyCaseResults.css
.acr-cq:where([data-rk-59ce98]) { container-type: inline-size; }
.acr:where([data-rk-59ce98]) { display: grid; gap: clamp(2rem, 6cqi, 4rem); color: var(--c-text-1, #fff); }
.acr__story:where([data-rk-59ce98]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.5rem, 5cqi, 4rem); }
.acr__h:where([data-rk-59ce98]) { margin: 0 0 var(--sp-4, 1rem); font-size: 0.85rem; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; text-align: left; color: var(--c-text-2, #a3a3a3); }
.acr__p:where([data-rk-59ce98]) { margin: 0; font-size: clamp(1.2rem, 2.4cqi, 1.5rem); line-height: 1.45; font-weight: 600; letter-spacing: -0.015em; }
.acr__steps:where([data-rk-59ce98]) { display: grid; gap: var(--sp-3, 0.75rem); margin: 0; padding: 0; list-style: none; counter-reset: acr; }
.acr__steps:where([data-rk-59ce98]) li:where([data-rk-59ce98]) { counter-increment: acr; display: grid; grid-template-columns: 40px 1fr; gap: 8px; line-height: 1.55; color: var(--c-text-2, #a3a3a3); }
.acr__steps:where([data-rk-59ce98]) li:where([data-rk-59ce98])::before { content: counter(acr, decimal-leading-zero); font-weight: 900; color: var(--agency-ink, var(--c-primary-light, #d4a017)); }
.acr__data:where([data-rk-59ce98]) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(1.25rem, 4cqi, 2.5rem); align-items: start; }
.acr__table:where([data-rk-59ce98]) { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.acr__table:where([data-rk-59ce98]) th:where([data-rk-59ce98]), .acr__table:where([data-rk-59ce98]) td:where([data-rk-59ce98]) { padding: 0.85rem 0.5rem; border-bottom: 1px solid var(--c-border, rgba(255, 255, 255, 0.14)); text-align: left; font-size: 0.95rem; }
.acr__table:where([data-rk-59ce98]) thead:where([data-rk-59ce98]) th:where([data-rk-59ce98]) { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c-text-3, #777); }
.acr__table:where([data-rk-59ce98]) tbody:where([data-rk-59ce98]) th:where([data-rk-59ce98]) { font-weight: 700; }
.acr__table:where([data-rk-59ce98]) td:where([data-rk-59ce98]) { color: var(--c-text-2, #a3a3a3); }
.acr__table:where([data-rk-59ce98]) td:where([data-rk-59ce98]) strong:where([data-rk-59ce98]) { color: var(--c-text-1, #fff); font-size: 1.1rem; }
.acr__chg:where([data-rk-59ce98]) { padding: 0.2rem 0.55rem; border-radius: 999px; background: var(--agency-accent, var(--c-primary-light, #d4a017)); color: var(--c-on-primary, #050505); font-size: 0.82rem; font-weight: 900; white-space: nowrap; }
.acr__chart:where([data-rk-59ce98]) { margin: 0; padding: var(--sp-5, 1.25rem); border-radius: var(--r-xl, 24px); background: var(--c-bg-1, #0d0d0d); border: 1.5px solid var(--c-border, rgba(255, 255, 255, 0.12)); }
.acr__chart:where([data-rk-59ce98]) figcaption:where([data-rk-59ce98]) { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: var(--sp-3, 0.75rem); font-size: 0.9rem; font-weight: 700; color: var(--c-text-2, #a3a3a3); }
.acr__chart:where([data-rk-59ce98]) figcaption:where([data-rk-59ce98]) strong:where([data-rk-59ce98]) { font-size: 1.8rem; font-weight: 900; letter-spacing: -0.04em; color: var(--c-text-1, #fff); }
.acr__chart:where([data-rk-59ce98]) svg:where([data-rk-59ce98]) { display: block; width: 100%; height: auto; overflow: visible; }
.acr__grid:where([data-rk-59ce98]) { stroke: var(--c-border, rgba(255, 255, 255, 0.12)); stroke-dasharray: 4 6; }
.acr__line:where([data-rk-59ce98]) { fill: none; stroke: var(--agency-ink, var(--c-primary-light, #d4a017)); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: agency-case-results-acr-draw 1.6s cubic-bezier(0.65, 0, 0.35, 1) 0.2s forwards; }
.acr__dot:where([data-rk-59ce98]) { fill: var(--agency-ink, var(--c-primary-light, #d4a017)); stroke: var(--c-bg-1, #0d0d0d); stroke-width: 3; vector-effect: non-scaling-stroke; }
@keyframes agency-case-results-acr-draw { to { stroke-dashoffset: 0; } }
.acr__axis:where([data-rk-59ce98]) { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.78rem; color: var(--c-text-3, #777); }
.acr__quote:where([data-rk-59ce98]) { margin: 0; padding: clamp(1.5rem, 5cqi, 3.5rem); border-radius: var(--r-xl, 28px); background: var(--agency-accent, var(--c-primary-light, #d4a017)); color: var(--c-on-primary, #050505); }
.acr__quote:where([data-rk-59ce98]) blockquote:where([data-rk-59ce98]) { margin: 0; }
.acr__quote:where([data-rk-59ce98]) p:where([data-rk-59ce98]) { color: inherit; margin: 0; font-size: clamp(1.5rem, 4cqi, 2.8rem); font-weight: 900; line-height: 1.08; letter-spacing: -0.04em; text-wrap: balance; }
.acr__quote:where([data-rk-59ce98]) figcaption:where([data-rk-59ce98]) { margin-top: var(--sp-5, 1.25rem); font-weight: 600; }
.sr-only:where([data-rk-59ce98]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@container (max-width: 820px) { .acr__story:where([data-rk-59ce98]), .acr__data:where([data-rk-59ce98]) { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .acr__line:where([data-rk-59ce98]) { animation: none; stroke-dashoffset: 0; } }