Skip to content

bug(shopping): chatgpt-shopping cards are captured but never normalized — pickParser has no ChatGPT branch #399

Closed

Description

@gkhngyk

Problem

ChatGPT Shopping tracking collects product cards but they never reach the Shopping dashboard. For a brand with shopping mode enabled:

  • chatgpt-shopping scraper tasks fire correctly (include.shopping: true, right country) and Cloro returns card data — the raw arrays land in prompt_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 from copilot-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 here

So 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

  1. Add a parseChatgptShoppingCard normalizer and wire it into pickParser (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/reuse flattenProductWrappers accordingly.
    • Derive the field mapping (title, brand, price, merchant URL/domain, rating, review count, image) from real captured payloads in prompt_results.shopping_cards rather 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).
  2. Backfill: the raw arrays are already persisted on prompt_results, so once the parser exists, server/src/scripts/backfill-shopping-cards.js can rebuild history — no data was lost, only never normalized.
  3. Brand matching (matchCardBrand) is platform-agnostic and should work as-is once cards flow.

Acceptance criteria

  • New chatgpt-shopping results produce rows in prompt_result_shopping_cards (platform = chatgpt-shopping)
  • Own-brand and competitor matching works on ChatGPT cards (roles populated, not everything other)
  • /dashboard/shopping Platforms filter shows ChatGPT alongside Copilot; KPIs/SoV include ChatGPT cards
  • Backfill script normalizes historical prompt_results.shopping_cards for chatgpt-shopping
  • Malformed card entries are skipped per-card, not per-batch

Activity

  1. added
    bug
    on Jul 10, 2026
  2. self-assigned this
    on Jul 10, 2026
  3. Sam-syntax35 commented on Jul 10, 2026

    @Sam-syntax35
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions