Commit Graph

10 Commits

Author SHA1 Message Date
ab875cd4d9 fix: JV scraper broken by brotli encoding + improved robustness
ROOT CAUSE: _browser_headers() included 'Accept-Encoding: gzip, deflate, br'
but the container has no brotli decoder. Server sent compressed response
that requests couldn't decode → garbled HTML → empty title → 'Could not
find product' error on Demo A and Demo C.

FIXES:
- Remove 'br' from Accept-Encoding (use 'gzip, deflate' only)
- Price extraction: try itemprop on any element, then .pricec class, then regex
- Image extraction: multi-strategy (itemprop, gallery links, CDN pattern, OG)
- Detect homepage redirect (product removed/renamed) → clear error message
- Increase timeout from 15s to 20s for JV product scraping

TESTED:
- D3+K2: Title ✓, Price £12.95 ✓, 10 benefits ✓, 3 images ✓
- Vitamin D3 4000iu: Title ✓, £8.95 ✓, 6 benefits ✓, 7 images ✓
- B12: Title ✓, £11.95 ✓, 10 benefits ✓, 7 images ✓
- Removed product: clean error 'redirected to homepage'
2026-03-02 22:43:38 +08:00
3cd296f6bf feat: dynamic data insights + remaining audit fixes
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.
2026-03-02 22:16:29 +08:00
ebe1dd5c14 fix: conversion audit — fix all broken CTAs, wrong data claims, hero rewrite
CRITICAL:
- Fix broken mailto: CTAs on /offer and /proposal (empty href!)
- Fix 97.4% channel dependency claim → actual 85% (verified from DB)
- Fix 37.3% repeat rate → 57.6% cohort return rate (verified)
- Fix revenue model payback math (was 2.6mo, actual 3.5mo at 100/mo)
- Fix cost-of-waiting claim with verifiable math

CONVERSION:
- Hero rewrite: 'Lost 84% of new customers' → client problem, not tech brag
- Nav: remove duplicate Proposal link, single 'The Proposal' → /offer
- Footer CTA: primary action is now 'See the Full Proposal'
- All CTAs now include properly formatted mailto with subject+body
- Replace unverified competitor claim with specific named competitors

DATA INTEGRITY:
- 15/23 claims verified SOURCE-LINKED from PostgreSQL (728K orders)
- 4 claims corrected (97.4%→85%, 37.3%→57.6%, payback, cost-of-waiting)
- Revenue calculator uses cohort-verified return rate
- Board summary updated with correct figures
2026-03-02 21:42:02 +08:00
ccfc9ceeb1 fix: bulletproof competitor scraper — 4-tier fallback chain
Tier 1-3: HTTP with Chrome/Firefox/Safari UAs + full browser headers
Tier 4: Gemini + Google Search grounding (bypasses everything)

- Dead URLs (404): skips straight to Gemini, finds product via Google
- Cloudflare/CAPTCHA: detected and routed to Gemini
- JS-rendered pages: Gemini reads them via Google's infrastructure
- Updated default competitor URL to Vitabiotics (works direct)

Tested against:
- H&B dead URL (404) → Gemini found full product data
- Boots (Cloudflare) → Gemini returned £4.00, 4.6★, 8 bullets
- Vitabiotics → direct Chrome scrape, 9 bullets
- Amazon (CAPTCHA) → Gemini grounding fallback
2026-03-02 21:12:55 +08:00
88fb443f63 fix: show only AI-generated images in PDP gallery, not originals
- Gallery now shows only the 5 AI-generated product photos
- Each thumb shows model name (Nano Banana / Pro) + caption
- Caption overlay on main image describes the shot type
- Removed original scraped images from gallery display
2026-03-02 20:56:26 +08:00
7e58ab1970 v4: Real product image generation + conversion PDP output
Image Generation:
- Downloads actual product images from justvitamins.co.uk
- Sends real photo as reference to Gemini (image-to-image)
- Generates 5 ecommerce-grade variations maintaining product consistency:
  Hero (clean studio), Lifestyle (kitchen scene), Scale (hand reference),
  Detail (ingredients close-up), Banner (wide hero)
- Uses Nano Banana Pro for hero/lifestyle/banner, Nano Banana for fast shots

PDP Output:
- Demo A now renders as a real ecommerce product detail page
- Gallery: original + AI-generated images with clickable thumbnails
- Above the fold: H1, value props, price block, trust bar, CTAs
- Key Benefits: Feature → Benefit → Proof format, 5 icon cards
- Stats bar, Why This Formula, 5★ review, FAQ accordion
- Meta SEO (Google preview), Ad Hooks (5 platform-targeted), Email sequences

Prompts:
- Conversion-optimised based on Cialdini/Kahneman principles
- EFSA health claim compliance baked into every prompt
- Feature → Benefit → Proof bullet structure
- Price anchoring, social proof, urgency psychology
2026-03-02 20:41:30 +08:00
3f2b6b6188 v3: PostgreSQL backend — 20K rows seeded, server-side SQL filtering
- Added PostgreSQL 16 Alpine service to Docker Swarm stack
- db.py: schema for 17 tables, auto-seed from jv_data.json on first boot
- /api/dashboard/data?start=&end= — server-side SQL filtering
  All Time: 0.43s (was 4MB JSON download stuck loading)
  Filtered (12mo): 0.20s with ~90% less data transferred
- Dashboard HTML patched: calls API instead of static JSON
- Integer casting for IsNewCustomer/HasDiscount/IsFreeShipping
- Advisory lock prevents race condition during parallel worker startup
- Returning Revenue now shows correctly: £14.5M (75% of total)
2026-03-02 20:24:15 +08:00
734142cf8f fix: dashboard route redirect for relative jv_data.json fetch 2026-03-02 20:04:25 +08:00
09d837a660 v2: Live Flask app — real Gemini AI demos, Nano Banana image gen, real £19.4M data dashboard
- Flask + gunicorn backend replacing static nginx
- 3 live AI demos powered by Gemini 2.5 Flash
- Nano Banana + Nano Banana Pro for product image generation
- Real JV ecommerce dashboard (728K orders, 230K customers, 4MB data)
- AI Infrastructure Proposal + Offer pages
- Live product scraper for justvitamins.co.uk + competitor pages
- API: /api/scrape, /api/generate-pack, /api/competitor-xray, /api/pdp-surgeon, /api/generate-images
2026-03-02 20:02:25 +08:00
26532ade3c Initial: JustVitamin AI Content Engine proposal site with 3 interactive demos 2026-03-02 19:29:47 +08:00