From 52dd17384a7f4376b67c1c68559301018903a434 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 11 Jun 2026 06:00:59 -0300 Subject: [PATCH] =?UTF-8?q?Dashboard:=20add=20trend=20arrows=20(=E2=96=B2/?= =?UTF-8?q?=E2=96=BC/=E2=97=8F)=20with=20color=20to=20Website=20stats=20?= =?UTF-8?q?=E2=80=94=20compares=20day-over-day=20+=20update-to-update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/insights.json | 19 ++++++++++++++++++- data/operations.json | 4 ++-- operations.html | 27 +++++++++++++++++++++++---- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/data/insights.json b/data/insights.json index e9c6f7e..6d2672a 100644 --- a/data/insights.json +++ b/data/insights.json @@ -1,9 +1,26 @@ { "period": "2026-06-09 to 2026-06-10", - "updated": "2026-06-11 08:30", + "updated": "2026-06-11 08:59", "visitors": 9, + "visitors_trend": { + "dir": "same", + "change": "+0", + "pct": "+0%" + }, "visitors_change": "", + "latest_day": "2026-06-10", + "latest_day_visitors": 5, + "dod_trend": { + "dir": "up", + "change": "+1", + "pct": "+25%" + }, "pageviews": 37, + "pageviews_trend": { + "dir": "same", + "change": "+0", + "pct": "+0%" + }, "pageviews_change": "", "bounce_rate": "\u2014", "bounce_rate_change": "", diff --git a/data/operations.json b/data/operations.json index d9eba6a..32f0b21 100644 --- a/data/operations.json +++ b/data/operations.json @@ -1,6 +1,6 @@ { "date": "Wednesday, June 10, 2026", - "updated": "2026-06-11T08:30:10-04:00", + "updated": "2026-06-11T08:59:40-04:00", "goals": [ { "current": 1, @@ -111,5 +111,5 @@ "Email capture (newsletter signup or lead magnet) needed before 10K/mo path is realistic." ], "day": 3, - "notes": "Day 3 auto-update at 08:30 UTC" + "notes": "Day 3 auto-update at 08:59 UTC" } \ No newline at end of file diff --git a/operations.html b/operations.html index 942f489..76fc077 100644 --- a/operations.html +++ b/operations.html @@ -1062,17 +1062,31 @@ period: '—', updated: '', visitors: 0, + visitors_trend: {dir: 'same', change: '', pct: ''}, pageviews: 0, + pageviews_trend: {dir: 'same', change: '', pct: ''}, + latest_day: '', + latest_day_visitors: 0, + dod_trend: {dir: 'same', change: '', pct: ''}, bounce_rate: '—', visit_duration: '—', top_referrers: [{source: 'Direct', visitors: 0}], countries: [], events: [], - visitors_by_day: [] + visitors_by_day: [], + agents_sold: 0 }; let websiteStats = { ...defaultStats }; + function trendArrow(t) { + if (!t || t.dir === 'same') return ''; + if (t.dir === 'new') return ''; + const arrow = t.dir === 'up' ? '▲' : '▼'; + const color = t.dir === 'up' ? 'var(--success)' : 'var(--danger)'; + return `${arrow} ${t.pct}`; + } + function renderWebsite() { const s = websiteStats; const overview = document.getElementById('stats-overview'); @@ -1084,18 +1098,23 @@
${s.visitors}
Unique Visitors
-
${s.period}
+
${trendArrow(s.visitors_trend)} ${s.period}
${s.pageviews}
Pageviews
-
${s.pageviews_per_visitor || (s.visitors > 0 ? (s.pageviews / s.visitors).toFixed(1) : '—')} avg
+
${trendArrow(s.pageviews_trend)} ${s.pageviews_per_visitor || (s.visitors > 0 ? (s.pageviews / s.visitors).toFixed(1) : '—')} avg
${s.agents_sold || 2}
Agents Sold
via Stripe
+
+
${s.latest_day_visitors}
+
${s.latest_day || 'Latest Day'}
+
${trendArrow(s.dod_trend)} vs prev day
+
`; } @@ -1122,7 +1141,7 @@ // Events card let eventRows = (s.events && s.events.length) - ? s.events.map(e => `
${e.name}${e.total} (${e.unique})
`).join('') + ? s.events.map(e => `
${e.name}${e.total} (${e.unique} uniq)
`).join('') : '
No event data yet
'; html += `

Custom Events