Repository navigation
Closed
Labels
bugSomething isn't working
Description
Problem
ChatGPT Shopping tracking collects product cards but they never reach the Shopping dashboard. For a brand with shopping mode enabled:
chatgpt-shoppingscraper tasks fire correctly (include.shopping: true, right country) and Cloro returns card data — the raw arrays land inprompt_results.shopping_cards(in one production brand: 53 results carrying 55 raw cards in the last 7 days alone).- Zero of those rows ever appear in
prompt_result_shopping_cards: every row in the analytical table comes fromcopilot-web.
Net effect on /dashboard/shopping: the Platforms filter/columns only ever show Copilot, ChatGPT presence (own and competitor) reads as zero, and Shopping SoV is computed from Copilot data alone — even when the raw ChatGPT cards demonstrably contain the brand's own products.
Root cause
pickParser in server/src/lib/shopping-cards.js (~line 282) only knows three platforms:
if (p.startsWith('perplexity')) return parsePerplexityCard;
if (p.startsWith('google-aimode') || p === 'google-ai-mode') return parseAiModeCard;
if (p.startsWith('copilot')) return parseCopilotCard;
return null; // ← chatgpt-shopping falls through hereSo normalizeShoppingCards('chatgpt-shopping', cards) always returns [], and persistShoppingCards (cloro-result-handler.js) silently inserts nothing. The capture side works; the normalize side drops everything.
Fix
- Add a
parseChatgptShoppingCardnormalizer and wire it intopickParser(p === 'chatgpt-shopping'/p.startsWith('chatgpt-')).- The ChatGPT card payload differs from the other three: entries can be large rich objects (tens of KB) and the array may contain wrapper elements (e.g. a
tags-keyed object) rather than flat product cards, so extend/reuseflattenProductWrappersaccordingly. - Derive the field mapping (title, brand, price, merchant URL/domain, rating, review count, image) from real captured payloads in
prompt_results.shopping_cardsrather than guessing — every self-hosted install with shopping mode on has samples. - Unknown/unmappable entries should be skipped without failing the batch (same per-card try/catch the other parsers get via
normalizeShoppingCards).
- The ChatGPT card payload differs from the other three: entries can be large rich objects (tens of KB) and the array may contain wrapper elements (e.g. a
- Backfill: the raw arrays are already persisted on
prompt_results, so once the parser exists,server/src/scripts/backfill-shopping-cards.jscan rebuild history — no data was lost, only never normalized. - Brand matching (
matchCardBrand) is platform-agnostic and should work as-is once cards flow.
Acceptance criteria
- New
chatgpt-shoppingresults produce rows inprompt_result_shopping_cards(platform =chatgpt-shopping) - Own-brand and competitor matching works on ChatGPT cards (roles populated, not everything
other) -
/dashboard/shoppingPlatforms filter shows ChatGPT alongside Copilot; KPIs/SoV include ChatGPT cards - Backfill script normalizes historical
prompt_results.shopping_cardsforchatgpt-shopping - Malformed card entries are skipped per-card, not per-batch
Activity
Sam-syntax35 commentedon Jul 10, 2026
This looks like a really interesting issue definitely one of the most challenging ones I've come across in the project so far. If it ends up being available, I'd love to take a shot at working on it.
fix(shopping): normalize chatgpt-shopping cards — pickParser gains a …