Skip to content

feat(tracking): capture Google AI Mode shopping cards into prompt_results - #86

Merged
gkhngyk merged 1 commit into
mainfrom
feat/tracking-aimode-shopping-cards
May 23, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feat/tracking-aimode-shopping-cards

Conversation

@gkhngyk

@gkhngyk gkhngyk commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Third companion to #46 (Perplexity) and #47 (Copilot) — captures Google AI Mode's product cards into prompt_results.shopping_cards, the same column, stored raw. Single-line-ish change in the AI Mode branch of cloro-scraper.js.

Closes #49

⚠️ Spec correction: AI Mode uses camelCase shoppingCards, not snake_case

The issue says AI Mode returns snake_case result.shopping_cards (like Perplexity). Against the live Cloro response that's not the case — AI Mode returns camelCase shoppingCards (like Copilot). The issue's suggested result.shopping_cards ?? [] would always yield [].

Verified live (google-aimode, "best wireless headphones under $200"):

response top-level keys: [ text, sources, citationPills, shoppingCards, inlineProducts, markdown ]
shoppingCards: array(5)   shopping_cards: undefined

A real populated card:

{
  "title": "Sony ULT WEAR Wireless Noise Canceling Headphones",
  "productLink": "https://www.google.com/search?...",
  "price": { "value": 148, "currency": "$", "raw": "$148.00. Was $248" },
  "store": "Best Buy & more",
  "rating": 4.7,
  "reviews": "5.2K",
  "oldPrice": { "value": 248, "currency": "$", "raw": "$248" }
}

So the product shape is also camelCase (productLink, oldPrice, price.raw), not the snake_case the issue table listed. We store verbatim regardless — the future UI should branch on platform === 'google-aimode' and expect this shape.

Change

server/src/lib/cloro-scraper.js, AI Mode branch:

shopping_cards: aiMode.shoppingCards ?? [],

(aiMode = result.result || result; live response is flat so aiMode === result. Using aiMode keeps it consistent with how text/sources are read in the same branch.)

The separate inlineProducts array (also present, camelCase) is a different surface — left out of scope per the issue.

Verification

  • node --check passes.
  • Live smoke caught a populated shoppingCards array (above); the camelCase key + shape are confirmed against the real response.

Notes

…ults

Third companion to #46 (Perplexity) and #47 (Copilot). AI Mode returns
its product cards under camelCase `shoppingCards` — verified against the
live Cloro response (the issue text said snake_case, but the real key is
camelCase, like Copilot). Unwrap it into the shared snake_case
`shopping_cards` parsed key in the AI Mode branch; stored verbatim.

Its separate `inlineProducts` array is a different surface, left out of
scope per the issue.

Closes #49
@gkhngyk
gkhngyk merged commit e258dad into main May 23, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — c5ab7305 Deployed May 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tracking): capture Google AI Mode shopping_cards data into prompt_results

1 participant