From 3cd296f6bf55ac9b10258f69699a7e2c0431cc59 Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Mon, 2 Mar 2026 22:16:29 +0800 Subject: [PATCH] feat: dynamic data insights + remaining audit fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DATA FIXES: - Dashboard insights now fully dynamic per date range - Revenue/orders/newcust/AOV trend (splits data in half, compares) - Channel concentration % computed from filtered data - Repeat revenue % with date-range label - All insights adapt when user changes date filter/preset - Offer page charts now load from API (not hardcoded arrays) - Revenue chart, new customer chart, channel donut = live data - Hero stats (-84%, -42%, 85%) computed dynamically from API - ROI calculator AOV pulled from latest year's actual data REMAINING AUDIT FIXES: - Fix #4: 'Built by' section on offer page (name, bio, contact) - Fix #9: Before/After comparison block on homepage - Side-by-side: current JV PDP flaws vs AI engine output - 8 specific ✗/✓ comparison points - Fix #6: Before/after serves as instant proof (no 90s wait) All 10 audit fixes now implemented. --- static/dashboard/index.html | 73 +++++++++++++--- static/offer/index.html | 161 ++++++++++++++++++++++++++---------- templates/index.html | 44 ++++++++++ 3 files changed, 222 insertions(+), 56 deletions(-) diff --git a/static/dashboard/index.html b/static/dashboard/index.html index 87d7362..755d76c 100644 --- a/static/dashboard/index.html +++ b/static/dashboard/index.html @@ -387,18 +387,69 @@ function buildExec(fm){ `
${k.l}
${k.v}
${k.s}
` ).join(''); - // Insights - const latestYear = fm.filter(r=>r.YearMonth>='2025-01'); - const prevYear = fm.filter(r=>r.YearMonth>='2024-01'&&r.YearMonth<='2024-12'); - const lyRev = latestYear.reduce((s,r)=>s+r.revenue,0); - const pyRev = prevYear.reduce((s,r)=>s+r.revenue,0); - const yoyChange = pyRev > 0 ? ((lyRev - pyRev) / pyRev * 100) : 0; + // Dynamic range-aware insights + // Split into halves for trend comparison + const half = Math.floor(fm.length / 2); + const firstHalf = fm.slice(0, half); + const secondHalf = fm.slice(half); + const fhRev = firstHalf.reduce((s,r)=>s+r.revenue,0); + const shRev = secondHalf.reduce((s,r)=>s+r.revenue,0); + const revTrend = fhRev > 0 ? ((shRev - fhRev) / fhRev * 100) : 0; + const fhOrders = firstHalf.reduce((s,r)=>s+r.orders,0); + const shOrders = secondHalf.reduce((s,r)=>s+r.orders,0); + const orderTrend = fhOrders > 0 ? ((shOrders - fhOrders) / fhOrders * 100) : 0; + const fhNew = firstHalf.reduce((s,r)=>s+r.newCustomers,0); + const shNew = secondHalf.reduce((s,r)=>s+r.newCustomers,0); + const newTrend = fhNew > 0 ? ((shNew - fhNew) / fhNew * 100) : 0; + const fhAOV = fhOrders > 0 ? fhRev / fhOrders : 0; + const shAOV = shOrders > 0 ? shRev / shOrders : 0; + const aovTrend = fhAOV > 0 ? ((shAOV - fhAOV) / fhAOV * 100) : 0; - document.getElementById('execInsights').innerHTML = ` -
Avg Margin ${pct(avgMargin)}: ${avgMargin >= 55 ? 'Healthy margins across the product range.' : 'Margins are under pressure — review product costs and pricing.'}
-
Returning customer revenue: ${pct(repeatRevPct)} of revenue comes from repeat buyers. ${repeatRevPct > 40 ? 'Strong loyalty base to leverage.' : 'Opportunity to improve retention.'}
-
Items per order: ${fmt(avgItems,1)}. ${avgItems < 2 ? 'Most orders are single-item. Bundling and cross-sell could lift AOV.' : 'Good cross-sell rate.'}
- `; + // Channel concentration for this date range + const chFilt = filterArr(RAW.channelMonthly); + const chTotals = {}; + chFilt.forEach(r => { chTotals[r.ReferrerSource] = (chTotals[r.ReferrerSource]||0) + r.orders; }); + const chTotal = Object.values(chTotals).reduce((a,b)=>a+b,0); + const googleOrg = (chTotals['Organic']||0) + (chTotals['Google Adwords']||0); + const googlePct = chTotal > 0 ? googleOrg / chTotal * 100 : 0; + const socialPct = chTotal > 0 ? ((chTotals['Facebook']||0) / chTotal * 100) : 0; + + const rangeLabel = FSTART && FEND ? `${FSTART} to ${FEND}` : FSTART ? `${FSTART} onwards` : FEND ? `up to ${FEND}` : 'all time'; + const halfLabel1 = firstHalf.length ? `${firstHalf[0].YearMonth}–${firstHalf[firstHalf.length-1].YearMonth}` : ''; + const halfLabel2 = secondHalf.length ? `${secondHalf[0].YearMonth}–${secondHalf[secondHalf.length-1].YearMonth}` : ''; + + let insightsHtml = ''; + + // Revenue trend + if(fm.length >= 4) { + insightsHtml += `
Revenue ${revTrend >= 0 ? '↑' : '↓'} ${pct(Math.abs(revTrend))}: ${gbp(shRev)} in ${halfLabel2} vs ${gbp(fhRev)} in ${halfLabel1}. ${revTrend < -10 ? 'Declining trend in this range.' : revTrend > 10 ? 'Growing in this range.' : 'Relatively flat.'}
`; + } + + // New customer trend + if(fm.length >= 4 && fhNew > 0) { + insightsHtml += `
New customers ${newTrend >= 0 ? '↑' : '↓'} ${pct(Math.abs(newTrend))}: ${fmt(shNew)} new customers in second half vs ${fmt(fhNew)} in first half of this range.
`; + } + + // AOV trend + if(fm.length >= 4) { + insightsHtml += `
AOV ${aovTrend >= 0 ? '↑' : '↓'} ${pct(Math.abs(aovTrend))}: ${gbp(shAOV)} vs ${gbp(fhAOV)}. ${aovTrend > 5 ? 'Customers are spending more per order.' : aovTrend < -5 ? 'Average basket value declining.' : 'AOV holding steady.'}
`; + } + + // Margins + insightsHtml += `
Avg margin ${pct(avgMargin)}: ${avgMargin >= 55 ? 'Healthy margins across the product range.' : 'Margins under pressure — review product costs and pricing.'}
`; + + // Returning revenue + insightsHtml += `
Returning customer revenue: ${pct(repeatRevPct)} of revenue comes from repeat buyers (${rangeLabel}). ${repeatRevPct > 60 ? 'Extremely loyal base — but dependency on existing customers may mask acquisition weakness.' : repeatRevPct > 40 ? 'Strong loyalty base to leverage.' : 'Opportunity to improve retention.'}
`; + + // Channel concentration + if(chTotal > 0) { + insightsHtml += `
Channel concentration: ${pct(googlePct)} of orders from Google channels (Organic + Ads) in this range. ${socialPct < 1 ? 'Social commerce is under ' + pct(socialPct) + ' — virtually zero discovery from social channels.' : 'Social contributing ' + pct(socialPct) + '.'}
`; + } + + // Items per order + insightsHtml += `
Items per order: ${fmt(avgItems,1)}. ${avgItems < 2 ? 'Most orders are single-item. Bundling and cross-sell could lift AOV.' : 'Good cross-sell rate.'}
`; + + document.getElementById('execInsights').innerHTML = insightsHtml; // Revenue + Orders chart destroyChart('revOrdersChart'); diff --git a/static/offer/index.html b/static/offer/index.html index 415d1cf..a981993 100644 --- a/static/offer/index.html +++ b/static/offer/index.html @@ -599,6 +599,19 @@ input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:20px;heigh
How is this different from hiring an agency?+
An agency charges monthly for services and you own nothing when you leave. This is a one-time infrastructure build — you own the server, the workflows, the content, and the integrations. The £500/mo covers hosting and maintenance only. If you cancel, you keep the infrastructure and can self-host.
+ +
+
O
+
+
Omair · QuikCue
+
I build AI infrastructure for ecommerce brands — automation, content engines, and data systems. This proposal was built using the same tools I'm proposing to install. Every demo, every chart, every number on this page is real.
+
+omair@quikcue.com +quikcue.com +
+
+
+ + +
+ 📊 WHAT THE AI ENGINE PRODUCES +

Before → After: Real Product Comparison

+

Same product. Left is the current justvitamins.co.uk page. Right is what the AI engine generates in 90 seconds.

+
+
+
Current PDP
+
+
Super Strength Vitamin D3 4000iu + K2
+
justvitamins.co.uk — actual product page
+
+
Generic subtitle: "A powerful pairing"
+
Single product photo (pouch only)
+
No benefit-driven bullets (Feature→Benefit→Proof)
+
No trust signals (money-back, UK-made, certifications)
+
No price anchoring (daily cost, cost-per-dose)
+
No SEO meta description
+
No ad hooks or email sequences
+
Cookie consent modal covers half the page
+
+
+
+
+
AI-Generated PDP
+
+
Same product — generated in ~90 seconds
+
Conversion-optimised by Gemini AI
+
+
5 AI-generated product photos (lifestyle, scale, detail, banner)
+
Feature → Benefit → Proof bullet structure
+
Trust bar: money-back, UK-made, EFSA claims
+
Price anchoring: "just 14p per day"
+
Full FAQ accordion with objection handling
+
SEO meta + Open Graph tags
+
3 ad hooks + 3 email sequences
+
4 copy styles: Balanced, Premium, Direct, Medical-Safe
+
+
+
+
+

↑ Run Demo A above to see the full AI-generated PDP for any JustVitamins product

+
+
🔍 DEMO B — LIVE