Skip to content

LGC-2026-08-12T044037

@joshliebe joshliebe tagged this 11 Aug 18:53
Task/Issue URL:
https://app.asana.com/1/137249556945/project/488551667048375/task/1217279121853562?focus=true
Tech Design URL (if applicable): 
API Proposals URL(s) (if applicable):

### Description
Adds the follwoing pixels for contextual suggestions:

1. `aichat_contextual_suggestion_selected` - Fired when a suggestion is
tapped

params:
- `suggestionId` - The catalog id of the suggestion (e.g.
"translate-page")
- `pageType` - A course bucket for the kind of page (e.g. "recipe”)

---

2. `aichat_contextual_suggestions_viewed` - Fired once when the
suggestions become visible

params:
- `isSmart` - Indicates whether suggestions were matched to the page or
are defaults
- `pageType` - A course bucket for the kind of page (e.g. "recipe”)

---

3. `debug_aichat_contextual_suggestions_context_collection_timed_out` -
Fired when the page context hasn't arrived in 5 seconds

---

5. `debug_aichat_contextual_suggestions_catalog_load_failed` - Fired
when the catalog fails to load

### Steps to test this PR

- [x] Go to a news article, recipe etc.
- [x] Open contextual
- [x] Verify `aichat_contextual_suggestions_viewed_count with params:
{isSmart, pageType}` is sent (count + daily)
- [x] Hide contextual and open it again
- [x] Verify `aichat_contextual_suggestions_viewed_count with params:
{isSmart, pageType}` is sent (count)
- [x] Tap a suggestion
- [x] Verify `aichat_contextual_suggestion_selected_count with params:
{suggestionId, pageType}` is sent (count + daily)
- [x] Go to different site and tap a suggestion
- [x] Verify `aichat_contextual_suggestion_selected_count with params:
{suggestionId, pageType}` is sent (count)
<!-- CURSOR_SUMMARY —>
—

> [!NOTE]
> **Low Risk**
> Analytics-only changes in Duck.ai contextual UI with no auth, payment,
or data-pipeline modifications; behavioral tweak limits suggestion
refresh to INPUT mode.
> 
> **Overview**
> Adds **analytics pixels** for contextual Duck.ai suggested prompts on
the sheet start surface, plus the wiring to fire them from the
suggestions pipeline.
> 
> **Pixel definitions** in `duck_chat.json5` cover suggestion taps
(`aichat_contextual_suggestion_selected` with `suggestionId` and coarse
`pageType`), impressions (`aichat_contextual_suggestions_viewed` with
`isSmart` and `pageType`), and two debug/exception pixels for catalog
load failure and page-context collection timeout.
> 
> **Matcher and provider** now return `ResolvedPageSuggestions`
(suggestions, whether matching was contextual vs defaults, and
`SuggestionsPageType` from JSON-LD/og:type) instead of a plain list.
Catalog failure reports the debug pixel and still classifies page type
from signals.
> 
> **ViewModel and UI** fire viewed once per continuous display (reset on
clear/reopen), selected on tap, timeout on load delay, and when Ask
About Page is used with suggestions enabled an additional selected event
with `ask-about-page` alongside the legacy quick-action pixel. Page
context updates to suggestions run only in INPUT sheet mode.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
dd7a95d1fce43d5fc1ba58082ad3e463db09445f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY —>



<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Analytics-only changes and a small UX guard (INPUT-only suggestion
refresh, clear on hide); no auth, payments, or data pipeline changes.
> 
> **Overview**
> Adds **analytics** for contextual Duck.ai suggested prompts on the
sheet start surface, plus wiring from the suggestions pipeline into
`DuckChatPixels`.
> 
> **Pixel definitions** (`duck_chat.json5`, `params_dictionary.json`)
cover suggestion taps (`aichat_contextual_suggestion_selected` with
`suggestionId` and coarse `pageType`), impressions
(`aichat_contextual_suggestions_viewed` with `isSmart` and `pageType`),
and two debug pixels for catalog load failure and page-context
collection timeout.
> 
> **Matcher/provider** now return `ResolvedPageSuggestions` (suggestions
list, contextual-vs-default `isSmart`, and `SuggestionsPageType` from
JSON-LD/og:type) instead of a plain list. Catalog failure fires the
debug pixel and still classifies `pageType` from signals.
> 
> **ViewModel/UI** fire viewed once per display (reset on clear/reopen),
selected on tap, timeout after 5s without page context, and when Ask
About Page is used with suggestions enabled an extra selected event with
`ask-about-page` alongside the legacy quick-action pixel. Page context
updates to suggestions run only when the sheet is visible and in INPUT
mode; suggestions clear when the sheet is hidden.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
80ab3341a60f2582453c51b92ab000dcd38d680f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Assets 2
Loading