The user wants a channel heatmap dashboard that visualizes key marketing metrics:
- CAC (Customer Acquisition Cost) / LTV (Lifetime Value) ratio
- Payback period
- Saturation levels
- Marginal ROAS (Return on Ad Spend)
This is a marketing analytics dashboard. I need to create:
- A visually appealing heatmap-style dashboard
- Multiple data tables/visualizations
- Interactive elements (hover effects, maybe filters)
- Real-looking data for different marketing channels
Let me design this with:
- A dark theme with high contrast (avoiding the forbidden purple gradients)
- Heatmap visualization using color coding
- Multiple sections for each metric
- Animated elements for dynamic feel
- Interactive hover states
Color scheme ideas:
- Dark background (#0a0a0f or similar)
- Accent colors: Teal/Cyan for positive, Orange/Red for negative, Green for growth
- Grid lines in subtle gray
Metrics to display:
- CAC/LTV Ratio - lower is better (green), higher is worse (red)
- Payback Period (months) - shorter is better
- Saturation (%) - 0-100%, higher means channel is saturated
- Marginal ROAS - higher is better
Channels to include:
- Meta (Facebook/Instagram)
- Google Search
- Google Display
- TikTok
- YouTube
- LinkedIn
- Twitter/X
- Pinterest
- Email
- Direct Mail
- Affiliate
- Influencer
I'll create an animated heatmap with:
- Animated number counters
- Hover effects showing detailed tooltips
- Color gradients based on performance
- Particle or glow effects in background
- Animated transitions
Let me code this as a single HTML file with all CSS and JS inline.
Channel Heatmap Dashboard
I'll create a dynamic, visually striking heatmap dashboard for marketing channel analytics. Here's my approach:
- Dark theme with high contrast colors - cyan/teal for positive metrics, orange/red for warnings
- Interactive heatmap with animated value counters and glow effects
- Hover tooltips with detailed breakdowns
- Animated background with subtle grid and floating particles
- Real-time feel with pulsing indicators and smooth transitions
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Channel Heatmap Dashboard</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', system-ui, sans-serif;
background: #080810;
color: #e0e0e0;
min-height: 100vh;
overflow-x: hidden;
}
.background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
pointer-events: none;
}
.grid-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image:
linear-gradient(rgba(0, 200, 180, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 200, 180, 0.03) 1px, transparent 1px);
background-size: 50px 50px;
z-index: 1;
pointer-events: none;
}
.container {
position: relative;
z-index: 10;
max-width: 1600px;
margin: 0 auto;
padding: 30px;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 40px;
padding-bottom: 20px;
border-bottom: 1px solid rgba(0, 200, 180, 0.2);
}
.logo {
display: flex;
align-items: center;
gap: 15px;
}
.logo-icon {
width: 50px;
height: 50px;
background: linear-gradient(135deg, #00c8b4, #00a896);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 30px rgba(0, 200, 180, 0.4);
animation: pulse-glow 3s ease-in-out infinite;
}
@keyframes pulse-glow {
0%, 100% { box-shadow: 0 0 20px rgba(0, 200, 180, 0.4); }
50% { box-shadow: 0 0 40px rgba(0, 200, 180, 0.7); }
}
.logo-icon svg {
width: 28px;
height: 28px;
fill: #080810;
}
h1 {
font-size: 1.8rem;
font-weight: 600;
color: #fff;
letter-spacing: -0.5px;
}
.header-stats {
display: flex;
gap: 30px;
}
.stat-mini {
text-align: center;
}
.stat-mini-value {
font-size: 1.5rem;
font-weight: 700;
color: #00c8b4;
}
.stat-mini-label {
font-size: 0.75rem;
color: #888;
text-transform: uppercase;
letter-spacing: 1px;
}
.metrics-nav {
display: flex;
gap: 10px;
margin-bottom: 30px;
flex-wrap: wrap;
}
.metric-tab {
padding: 12px 24px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 8px;
color: #888;
cursor: pointer;
transition: all 0.3s ease;
font-size: 0.9rem;
font-weight: 500;
}
.metric-tab:hover {
background: rgba(0, 200, 180, 0.1);
border-color: rgba(0, 200, 180, 0.3);
color: #00c8b4;
}
.metric-tab.active {
background: linear-gradient(135deg, rgba(0, 200, 180, 0.2), rgba(0, 168, 150, 0.1));
border-color: #00c8b4;
color: #00c8b4;
box-shadow: 0 0 20px rgba(0, 200, 180, 0.2);
}
.heatmap-container {
background: rgba(12, 12, 20, 0.8);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.06);
overflow: hidden;
backdrop-filter: blur(10px);
}
.heatmap-header {
display: grid;
grid-template-columns: 180px repeat(12, 1fr);
background: rgba(0, 0, 0, 0.3);
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.heatmap-corner {
padding: 15px;
font-size: 0.75rem;
color: #666;
text-transform: uppercase;
letter-spacing: 1px;
display: flex;
align-items: center;
}
.month-header {
padding: 15px 5px;
text-align: center;
font-size: 0.75rem;
color: #888;
font-weight: 500;
border-left: 1px solid rgba(255, 255, 255, 0.04);
}
.heatmap-body {
display: flex;
flex-direction: column;
}
.channel-row {
display: grid;
grid-template-columns: 180px repeat(12, 1fr);
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
transition: background 0.3s ease;
}
.channel-row:hover {
background: rgba(0, 200, 180, 0.05);
}
.channel-row:last-child {
border-bottom: none;
}
.channel-info {
padding: 12px 15px;
display: flex;
align-items: center;
gap: 10px;
background: rgba(0, 0, 0, 0.2);
}
.channel-icon {
width: 32px;
height: 32px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.8rem;
font-weight: 700;
}
.channel-name {
font-weight: 500;
font-size: 0.85rem;
color: #ccc;
}
.channel-spend {
font-size: 0.7rem;
color: #666;
}
.heat-cell {
padding: 12px 5px;
text-align: center;
font-size: 0.8rem;
font-weight: 600;
border-left: 1px solid rgba(255, 255, 255, 0.04);
cursor: pointer;
transition: all 0.3s ease;
position: relative;
}
.heat-cell:hover {
transform: scale(1.05);
z-index: 10;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}
.heat-cell::after {
content: '';
position: absolute;
inset: 2px;
border-radius: 4px;
opacity: 0;
transition: opacity 0.3s ease;
}
.heat-cell:hover::after {
opacity: 1;
box-shadow: 0 0 15px currentColor;
}
/* Color scales for different metrics */
.scale-excellent { background: rgba(0, 200, 100, 0.4); color: #00ff88; }
.scale-good { background: rgba(0, 180, 160, 0.35); color: #00c8b4; }
.scale-moderate { background: rgba(255, 180, 0, 0.3); color: #ffb400; }
.scale-warning { background: rgba(255, 120, 0, 0.35); color: #ff8800; }
.scale-poor { background: rgba(255, 60, 60, 0.35); color: #ff5555; }
.legend {
display: flex;
justify-content: center;
gap: 20px;
padding: 20px;
background: rgba(0, 0, 0, 0.2);
border-top: 1px solid rgba(255, 255, 255, 0.06);
flex-wrap: wrap;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
font-size: 0.75rem;
color: #888;
}
.legend-color {
width: 16px;
height: 16px;
border-radius: 4px;
}
.tooltip {
position: fixed;
background: rgba(15, 15, 25, 0.98);
border: 1px solid rgba(0, 200, 180, 0.3);
border-radius: 12px;
padding: 15px;
pointer-events: none;
opacity: 0;
transition: opacity 0.2s ease;
z-index: 1000;
min-width: 200px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.tooltip.visible {
opacity: 1;
}
.tooltip-title {
font-weight: 600;
color: #fff;
margin-bottom: 10px;
padding-bottom: 8px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.tooltip-row {
display: flex;
justify-content: space-between;
margin: 6px 0;
font-size: 0.85rem;
}
.tooltip-label {
color: #888;
}
.tooltip-value {
font-weight: 600;
}
.summary-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 20px;
margin-top: 30px;
}
.summary-card {
background: rgba(12, 12, 20, 0.8);
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.06);
padding: 25px;
backdrop-filter: blur(10px);
transition: all 0.3s ease;
}
.summary-card:hover {
transform: translateY(-5px);
border-color: rgba(0, 200, 180, 0.3);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.card-title {
font-size: 0.85rem;
color: #888;
text-transform: uppercase;
letter-spacing: 1px;
}
.card-badge {
padding: 4px 10px;
border-radius: 20px;
font-size: 0.7rem;
font-weight: 600;
}
.badge-up {
background: rgba(0, 200, 100, 0.2);
color: #00c864;
}
.badge-down {
background: rgba(255, 80, 80, 0.2);
color: #ff5050;
}
.card-value {
font-size: 2.5rem;
font-weight: 700;
color: #fff;
margin-bottom: 10px;
}
.card-subtitle {
font-size: 0.8rem;
color: #666;
}
.card-chart {
height: 60px;
margin-top: 15px;
display: flex;
align-items: flex-end;
gap: 4px;
}
.chart-bar {
flex: 1;
background: linear-gradient(to top, rgba(0, 200, 180, 0.3), rgba(0, 200, 180, 0.1));
border-radius: 3px 3px 0 0;
transition: all 0.3s ease;
}
.chart-bar:hover {
background: linear-gradient(to top, rgba(0, 200, 180, 0.6), rgba(0, 200, 180, 0.3));
}
.particles {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 2;
}
.particle {
position: absolute;
width: 4px;
height: 4px;
background: rgba(0, 200, 180, 0.6);
border-radius: 50%;
animation: float-particle 15s infinite ease-in-out;
}
@keyframes float-particle {
0%, 100% {
transform: translateY(100vh) translateX(0);
opacity: 0;
}
10% { opacity: 1; }
90% { opacity: 1; }
100% {
transform: translateY(-100px) translateX(100px);
opacity: 0;
}
}
.insight-bar {
background: rgba(12, 12, 20, 0.8);
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.06);
padding: 15px 20px;
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 15px;
backdrop-filter: blur(10px);
}
.insight-icon {
width: 36px;
height: 36px;
background: linear-gradient(135deg, rgba(0, 200, 180, 0.3), rgba(0, 168, 150, 0.2));
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
color: #00c8b4;
}
.insight-text {
flex: 1;
font-size: 0.9rem;
color: #aaa;
}
.insight-text strong {
color: #00c8b4;
}
@media (max-width: 1200px) {
.heatmap-header, .channel-row {
grid-template-columns: 140px repeat(12, 1fr);
}
.channel-info {
flex-direction: column;
align-items: flex-start;
gap: 4px;
}
.channel-icon {
width: 24px;
height: 24px;
font-size: 0.7rem;
}
}
@media (max-width: 768px) {
.container {
padding: 15px;
}
header {
flex-direction: column;
gap: 20px;
}
.heatmap-container {
overflow-x: auto;
}
.heatmap-header, .channel-row {
min-width: 900px;
}
}
</style>
</head>
<body>
<canvas class="background" id="bgCanvas"></canvas>
<div class="grid-overlay"></div>
<div class="particles" id="particles"></div>
<div class="container">
<header>
<div class="logo">
<div class="logo-icon">
<svg viewBox="0 0 24 24"><path d="M3 3v18h18V3H3zm16 16H5V5h14v14zM7 12h2v5H7v-5zm4-3h2v8h-2V9zm4-3h2v11h-2V6z"/></svg>
</div>
<div>
<h1>Channel Performance Heatmap</h1>
</div>
</div>
<div class="header-stats">
<div class="stat-mini">
<div class="stat-mini-value" id="totalSpend">$2.4M</div>
<div class="stat-mini-label">Total Spend</div>
</div>
<div class="stat-mini">
<div class="stat-mini-value" id="avgRoas">3.2x</div>
<div class="stat-mini-label">Avg ROAS</div>
</div>
<div class="stat-mini">
<div class="stat-mini-value" id="activeChannels">12</div>
<div class="stat-mini-label">Channels</div>
</div>
</div>
</header>
<div class="insight-bar">
<div class="insight-icon">
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>
</div>
<div class="insight-text">
<strong>TikTok</strong> shows declining marginal ROAS (-23% MoM). Consider reallocating budget to <strong>Google Search</strong> which has 40% headroom before saturation.
</div>
</div>
<div class="metrics-nav">
<div class="metric-tab active" data-metric="cac_ltv">CAC/LTV Ratio</div>
<div class="metric-tab" data-metric="payback">Payback Period</div>
<div class="metric-tab" data-metric="saturation">Saturation</div>
<div class="metric-tab" data-metric="marginal_roas">Marginal ROAS</div>
</div>
<div class="heatmap-container">
<div class="heatmap-header">
<div class="heatmap-corner">Channel</div>
<div class="month-header">Jan</div>
<div class="month-header">Feb</div>
<div class="month-header">Mar</div>
<div class="month-header">Apr</div>
<div class="month-header">May</div>
<div class="month-header">Jun</div>
<div class="month-header">Jul</div>
<div class="month-header">Aug</div>
<div class="month-header">Sep</div>
<div class="month-header">Oct</div>
<div class="month-header">Nov</div>
<div class="month-header">Dec</div>
</div>
<div class="heatmap-body" id="heatmapBody"></div>
<div class="legend" id="legend"></div>
</div>
<div class="summary-cards">
<div class="summary-card">
<div class="card-header">
<div class="card-title">Blended CAC/LTV</div>
<div class="card-badge badge-up">+8%</div>
</div>
<div class="card-value">0.32</div>
<div class="card-subtitle">Target: < 0.40</div>
<div class="card-chart" id="chart1"></div>
</div>
<div class="summary-card">
<div class="card-header">
<div class="card-title">Avg Payback Period</div>
<div class="card-badge badge-down">-12%</div>
</div>
<div class="card-value">4.2 mo</div>
<div class="card-subtitle">Target: < 6 months</div>
<div class="card-chart" id="chart2"></div>
</div>
<div class="summary-card">
<div class="card-header">
<div class="card-title">Portfolio Saturation</div>
<div class="card-badge badge-up">+5%</div>
</div>
<div class="card-value">67%</div>
<div class="card-subtitle">Warning: > 80%</div>
<div class="card-chart" id="chart3"></div>
</div>
<div class="summary-card">
<div class="card-header">
<div class="card-title">Avg Marginal ROAS</div>
<div class="card-badge badge-down">-3%</div>
</div>
<div class="card-value">2.1x</div>
<div class="card-subtitle">Breakeven: 1.0x</div>
<div class="card-chart" id="chart4"></div>
</div>
</div>
</div>
<div class="tooltip" id="tooltip"></div>
<script>
// Channel data
const channels = [
{ name: 'Meta', icon: 'M', color: '#1877F2', spend: '$420K' },
{ name: 'Google Search', icon: 'G', color: '#4285F4', spend: '$380K' },
{ name: 'Google Display', icon: 'G', color: '#34A853', spend: '$180K' },
{ name: 'TikTok', icon: 'T', color: '#000', spend: '$290K' },
{ name: 'YouTube', icon: 'Y', color: '#FF0000', spend: '$260K' },
{ name: 'LinkedIn', icon: 'L', color: '#0A66C2', spend: '$220K' },
{ name: 'Twitter/X', icon: 'X', color: '#000', spend: '$140K' },
{ name: 'Pinterest', icon: 'P', color: '#E60023', spend: '$120K' },
{ name: 'Email', icon: 'E', color: '#00c8b4', spend: '$45K' },
{ name: 'Affiliates', icon: 'A', color: '#ff6b35', spend: '$180K' },
{ name: 'Influencers', icon: 'I', color: '#9b59b6', spend: '$160K' },
{ name: 'Direct Mail', icon: 'D', color: '#2ecc71', spend: '$85K' }
];
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
// Generate realistic metric data
function generateMetricData(metric) {
const data = {};
channels.forEach(channel => {
data[channel.name] = [];
for (let i = 0; i < 12; i++) {
let base, variance;
switch(metric) {
case 'cac_ltv':
base = 0.25 + Math.random() * 0.35;
variance = 0.1;
break;
case 'payback':
base = 2 + Math.random() * 6;
variance = 1;
break;
case 'saturation':
base = 30 + Math.random() * 60;
variance = 10;
break;
case 'marginal_roas':
base = 0.8 + Math.random() * 3.5;
variance = 0.5;
break;
}
// Add trend
const trend = (i / 12) * (Math.random() - 0.3) * base * 0.3;
const seasonality = Math.sin(i / 2) * variance;
let value = base + trend + seasonality + (Math.random() - 0.5) * variance;
if (metric === 'payback') value = Math.max(1, Math.min(12, value));
else if (metric === 'saturation') value = Math.max(10, Math.min(98, value));
else if (metric === 'cac_ltv') value = Math.max(0.15, Math.min(0.8, value));
else if (metric === 'marginal_roas') value = Math.max(0.3, Math.min(5, value));
data[channel.name].push(value);
}
});
return data;
}
const metricsData = {
cac_ltv: generateMetricData('cac_ltv'),
payback: generateMetricData('payback'),
saturation: generateMetricData('saturation'),
marginal_roas: generateMetricData('marginal_roas')
};
const metricConfig = {
cac_ltv: {
format: v => v.toFixed(2),
getClass: v => {
if (v < 0.30) return 'scale-excellent';
if (v < 0.40) return 'scale-good';
if (v < 0.50) return 'scale-moderate';
if (v < 0.60) return 'scale-warning';
return 'scale-poor';
},
legend: [
{ label: '< 0.30 (Excellent)', class: 'scale-excellent' },
{ label: '0.30 - 0.40 (Good)', class: 'scale-good' },
{ label: '0.40 - 0.50 (Moderate)', class: 'scale-moderate' },
{ label: '0.50 - 0.60 (Warning)', class: 'scale-warning' },
{ label: '> 0.60 (Poor)', class: 'scale-poor' }
]
},
payback: {
format: v => v.toFixed(1) + 'mo',
getClass: v => {
if (v < 3) return 'scale-excellent';
if (v < 4) return 'scale-good';
if (v < 6) return 'scale-moderate';
if (v < 8) return 'scale-warning';
return 'scale-poor';
},
legend: [
{ label: '< 3 mo (Excellent)', class: 'scale-excellent' },
{ label: '3 - 4 mo (Good)', class: 'scale-good' },
{ label: '4 - 6 mo (Moderate)', class: 'scale-moderate' },
{ label: '6 - 8 mo (Warning)', class: 'scale-warning' },
{ label: '> 8 mo (Poor)', class: 'scale-poor' }
]
},
saturation: {
format: v => Math.round(v) + '%',
getClass: v => {
if (v < 40) return 'scale-excellent';
if (v < 55) return 'scale-good';
if (v < 70) return 'scale-moderate';
if (v < 85) return 'scale-warning';
return 'scale-poor';
},
legend: [
{ label: '< 40% (Headroom)', class: 'scale-excellent' },
{ label: '40 - 55% (Healthy)', class: 'scale-good' },
{ label: '55 - 70% (Moderate)', class: 'scale-moderate' },
{ label: '70 - 85% (High)', class: 'scale-warning' },
{ label: '> 85% (Saturated)', class: 'scale-poor' }
]
},
marginal_roas: {
format: v => v.toFixed(1) + 'x',
getClass: v => {
if (v > 3.0) return 'scale-excellent';
if (v > 2.0) return 'scale-good';
if (v > 1.5) return 'scale-moderate';
if (v > 1.0) return 'scale-warning';
return 'scale-poor';
},
legend: [
{ label: '> 3.0x (Excellent)', class: 'scale-excellent' },
{ label: '2.0 - 3.0x (Good)', class: 'scale-good' },
{ label: '1.5 - 2.0x (Moderate)', class: 'scale-moderate' },
{ label: '1.0 - 1.5x (Warning)', class: 'scale-warning' },
{ label: '< 1.0x (Unprofitable)', class: 'scale-poor' }
]
}
};
let currentMetric = 'cac_ltv';
const tooltip = document.getElementById('tooltip');
const heatmapBody = document.getElementById('heatmapBody');
const legend = document.getElementById('legend');
function renderHeatmap() {
heatmapBody.innerHTML = '';
const config = metricConfig[currentMetric];
const data = metricsData[currentMetric];
channels.forEach(channel => {
const row = document.createElement('div');
row.className = 'channel-row';
const info = document.createElement('div');
info.className = 'channel-info';
info.innerHTML = `
<div class="channel-icon" style="background: ${channel.color}; color: white;">${channel.icon}</div>
<div>
<div class="channel-name">${channel.name}</div>
<div class="channel-spend">${channel.spend}/mo</div>
</div>
`;
row.appendChild(info);
data[channel.name].forEach((value, monthIndex) => {
const cell = document.createElement('div');
cell.className = `heat-cell ${config.getClass(value)}`;
cell.textContent = config.format(value);
cell.dataset.channel = channel.name;
cell.dataset.month = months[monthIndex];
cell.dataset.value = value;
cell.addEventListener('mouseenter', showTooltip);
cell.addEventListener('mousemove', moveTooltip);
cell.addEventListener('mouseleave', hideTooltip);
row.appendChild(cell);
});
heatmapBody.appendChild(row);
});
// Render legend
legend.innerHTML = config.legend.map(item => `
<div class="legend-item">
<div class="legend-color ${item.class}"></div>
<span>${item.label}</span>
</div>
`).join('');
}
function showTooltip(e) {
const cell = e.target;
const channel = cell.dataset.channel;
const month = cell.dataset.month;
const value = parseFloat(cell.dataset.value);
const config = metricConfig[currentMetric];
let extraInfo = '';
switch(currentMetric) {
case 'cac_ltv':
extraInfo = `
<div class="tooltip-row"><span class="tooltip-label">CAC:</span><span class="tooltip-value">$${(value * 200).toFixed(0)}</span></div>
<div class="tooltip-row"><span class="tooltip-label">LTV:</span><span class="tooltip-value">$${(200).toFixed(0)}</span></div>
<div class="tooltip-row"><span class="tooltip-label">Target:</span><span class="tooltip-value">< 0.40</span></div>
`;
break;
case 'payback':
extraInfo = `
<div class="tooltip-row"><span class="tooltip-label">Monthly Cohort:</span><span class="tooltip-value">${Math.floor(Math.random() * 500 + 200)}</span></div>
<div class="tooltip-row"><span class="tooltip-label">ARPU:</span><span class="tooltip-value">$${(45 + Math.random() * 20).toFixed(2)}</span></div>
`;
break;
case 'saturation':
extraInfo = `
<div class="tooltip-row"><span class="tooltip-label">Reach:</span><span class="tooltip-value">${(Math.random() * 2 + 1).toFixed(1)}M</span></div>
<div class="tooltip-row"><span class="tooltip-label">Frequency:</span><span class="tooltip-value">${(value / 20).toFixed(1)}x</span></div>
`;
break;
case 'marginal_roas':
extraInfo = `
<div class="tooltip-row"><span class="tooltip-label">Incremental:</span><span class="tooltip-value">$${(value * 1000).toFixed(0)}</span></div>
<div class="tooltip-row"><span class="tooltip-label">Spend Delta:</span><span class="tooltip-value">$1,000</span></div>
`;
break;
}
tooltip.innerHTML = `
<div class="tooltip-title">${channel} - ${month}</div>
<div class="tooltip-row"><span class="tooltip-label">Value:</span><span class="tooltip-value">${config.format(value)}</span></div>
${extraInfo}
`;
tooltip.classList.add('visible');
}
function moveTooltip(e) {
const x = e.clientX + 15;
const y = e.clientY + 15;
tooltip.style.left = Math.min(x, window.innerWidth - 220) + 'px';
tooltip.style.top = Math.min(y, window.innerHeight - 200) + 'px';
}
function hideTooltip() {
tooltip.classList.remove('visible');
}
// Tab switching
document.querySelectorAll('.metric-tab').forEach(tab => {
tab.addEventListener('click', () => {
document.querySelectorAll('.metric-tab').forEach(t => t.classList.remove('active'));
tab.classList.add('active');
currentMetric = tab.dataset.metric;
renderHeatmap();
});
});
// Initialize heatmap
renderHeatmap();
// Generate mini charts
function generateMiniChart(containerId, dataPoints) {
const container = document.getElementById(containerId);
container.innerHTML = '';
dataPoints.forEach(value => {
const bar = document.createElement('div');
bar.className = 'chart-bar';
bar.style.height = (value * 100) + '%';
container.appendChild(bar);
});
}
generateMiniChart('chart1', [0.6, 0.7, 0.65, 0.8, 0.75, 0.85, 0.7, 0.9, 0.8, 0.95, 0.85, 0.9]);
generateMiniChart('chart2', [0.5, 0.6, 0.55, 0.45, 0.5, 0.6, 0.55, 0.65, 0.6, 0.55, 0.5, 0.45]);
generateMiniChart('chart3', [0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.72, 0.7, 0.68, 0.67]);
generateMiniChart('chart4', [0.8, 0.85, 0.9, 0.75, 0.7, 0.65, 0.6, 0.55, 0.5, 0.45, 0.42, 0.4]);
// Background canvas animation
const canvas = document.getElementById('bgCanvas');
const ctx = canvas.getContext('2d');
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
resizeCanvas();
window.addEventListener('resize', resizeCanvas);
let time = 0;
function drawBackground() {
time += 0.005;
ctx.fillStyle = '#080810';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Draw flowing gradient waves
for (let i = 0; i < 3; i++) {
const gradient = ctx.createLinearGradient(0, canvas.height, 0, 0);
gradient.addColorStop(0, 'rgba(0, 200, 180, 0.03)');
gradient.addColorStop(0.5, 'rgba(0, 150, 140, 0.02)');
gradient.addColorStop(1, 'transparent');
ctx.beginPath();
ctx.moveTo(0, canvas.height);
for (let x = 0; x <= canvas.width; x += 20) {
const y = canvas.height - 100 -
Math.sin(x * 0.002 + time + i * 2) * 50 -
Math.sin(x * 0.005 + time * 1.5) * 30;
ctx.lineTo(x, y);
}
ctx.lineTo(canvas.width, canvas.height);
ctx.closePath();
ctx.fillStyle = gradient;
ctx.fill();
}
requestAnimationFrame(drawBackground);
}
drawBackground();
// Create floating particles
const particlesContainer = document.getElementById('particles');
for (let i = 0; i < 20; i++) {
const particle = document.createElement('div');
particle.className = 'particle';
particle.style.left = Math.random() * 100 + '%';
particle.style.animationDelay = Math.random() * 15 + 's';
particle.style.animationDuration = (15 + Math.random() * 10) + 's';
particle.style.width = (2 + Math.random() * 4) + 'px';
particle.style.height = particle.style.width;
particlesContainer.appendChild(particle);
}
// Animated counter for header stats
function animateValue(elementId, endValue, prefix = '', suffix = '') {
const element = document.getElementById(elementId);
const duration = 2000;
const start = 0;
const startTime = performance.now();
function update(currentTime) {
const elapsed = currentTime - startTime;
const progress = Math.min(elapsed / duration, 1);
const eased = 1 - Math.pow(1 - progress, 3);
const current = start + (endValue - start) * eased;
if (typeof endValue === 'number' && endValue % 1 !== 0) {
element.textContent = prefix + current.toFixed(1) + suffix;
} else {
element.textContent = prefix + Math.round(current) + suffix;
}
if (progress < 1) {
requestAnimationFrame(update);
}
}
requestAnimationFrame(update);
}
// Run animations after a short delay
setTimeout(() => {
// Stats already set in HTML for immediate display
}, 500);
</script>
</body>
</html>
Features
Metrics Displayed:
- CAC/LTV Ratio - Lower is better (green), measures customer acquisition efficiency
- Payback Period - Time to recover acquisition cost in months
- Saturation - How saturated each channel is (headroom vs. diminishing returns)
- Marginal ROAS - Return on the next dollar spent
Interactive Elements:
- Tab switching between different metrics with smooth transitions
- Hover tooltips showing detailed breakdowns (CAC, LTV, ARPU, etc.)
- Color-coded cells with 5-tier performance scale
- Animated background with flowing gradient waves
- Floating particles for visual depth
- Mini sparkline charts in summary cards
Visual Design:
- Dark theme with cyan/teal accent colors
- High contrast heatmap coloring (green = good, red = poor)
- Glowing effects on interactive elements
- Responsive grid layout for all screen sizes
- Backdrop blur effects for modern glass-morphism feel