Skip to content

Add page_type and source to prompt submission pixels - #9568

Open
YoussefKeyrouz wants to merge 2 commits into
feature/youssef/duck_ai_entry_point_attributionfrom
feature/youssef/duckai_prompt_origin
Open

Add page_type and source to prompt submission pixels#9568
YoussefKeyrouz wants to merge 2 commits into
feature/youssef/duck_ai_entry_point_attributionfrom
feature/youssef/duckai_prompt_origin

Conversation

@YoussefKeyrouz

@YoussefKeyrouz YoussefKeyrouz commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1217295011063285?focus=true
Tech Design URL (if applicable): https://app.asana.com/1/137249556945/project/481882893211075/task/1217382844057496?focus=true
API Proposals URL(s) (if applicable): https://app.asana.com/1/137249556945/project/1212810093780571/task/1217702991642481?focus=true

Description

Adds page_type and source to the three prompt-submitted pixels that exist:

  • m_aichat_unified_input_prompt_submitted
  • m_aichat_contextual_prompt_submitted_with_context_native
  • m_aichat_contextual_prompt_submitted_without_context_native.

page_type (ntp, serp, website, duck_ai, contextual, unknown) is resolved live from the current tab. source reuses the m_aichat_entry_point enum and is omitted when the entry point isn't known.

How source is resolved depends on whether the user is already inside Duck.ai:

  • Inside Duck.ai (DUCK_AI surface, an existing chat, possibly a follow-up prompt, possibly from
    an earlier app session): source is whatever entry point was recorded when that chat was entered. It’s read from a database entity that stores it on entry.
  • Outside Duck.ai (ADDRESS_BAR surface, the prompt is what's opening Duck.ai right now): source
    is that action itself, taken directly
  • The contextual sheet (CONTEXTUAL_CHAT surface): source is always the constant
    contextual_chat

Steps to test this PR

Install the internal build and filter Logcat on Pixel sent: plus the pixel names this PR touches:

Surface / action Pixel to check Expected page_type Expected source
Unified input on an NTP, Duck.ai side toggled, type and submit (not yet in a chat) m_aichat_unified_input_prompt_submitted_count/_daily ntp address_bar_prompt
Unified input on a loaded webpage (e.g. https://example.com/), Duck.ai side, type and submit m_aichat_unified_input_prompt_submitted_count/_daily website address_bar_prompt
Unified input on a DuckDuckGo SERP (https://duckduckgo.com/?q=test), Duck.ai side, type and submit m_aichat_unified_input_prompt_submitted_count/_daily serp address_bar_prompt
Tap the mic in the unified input and speak a query m_aichat_unified_input_prompt_submitted_count/_daily matches the current tab voice
Now already inside that Duck.ai chat, submit a follow-up prompt m_aichat_unified_input_prompt_submitted_count/_daily duck_ai same entry point that opened this chat (address_bar_prompt, voice, browsing_menu_ntp, etc.), carried forward from the database
Open Duck.ai via ⋮ > New Chat (browsing_menu_ntp/browsing_menu_webpage), then submit a prompt in the resulting tab m_aichat_unified_input_prompt_submitted_count/_daily duck_ai browsing_menu_ntp or browsing_menu_webpage
Contextual "Ask about page" sheet, submit with page context attached m_aichat_contextual_prompt_submitted_with_context_native_count/_daily contextual contextual_chat
Contextual sheet, submit without page context attached m_aichat_contextual_prompt_submitted_without_context_native_count/_daily contextual contextual_chat
Kill and relaunch the app, then submit a follow-up prompt in a Duck.ai tab that was already open m_aichat_unified_input_prompt_submitted_count/_daily duck_ai still the original entry point ,persisted in Room, not lost on process death
  • You can test many other entry points such as chat history or menu "New chat" or subscription etc... they should reflect the correct source for any prompt submitted after we open Duck.ai

UI changes

No UI changes


Note

Medium Risk
Adds a Room migration and tab-lifecycle attribution that can mis-tag analytics if claim/race logic is wrong, but it does not change product behavior or handle sensitive user data.

Overview
Prompt-submitted Duck.ai pixels now include page_type (ntp / serp / website / duck_ai / contextual) and source (the same entry-point enum as m_aichat_entry_point, omitted when unknown).

source is attributed per tab. Opening Duck.ai records a pending entry point; the next tab that actually lands on a Duck.ai URL claims it into a new Room table (duck_ai_tab_session, schema 63, cascade-deleted with the tab). Follow-up prompts in that chat reuse the stored source, including after process death. Address-bar submissions use the live action (e.g. voice vs prompt); the contextual sheet always reports contextual / contextual_chat.

Shared param dictionary entries duckAiPromptPageType and duckAiEntrySource replace the inline source enum on the entry-point pixel. Native input now tracks the current tab URL so page_type can be resolved without racing navigation.

Reviewed by Cursor Bugbot for commit 088f3dc. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Collaborator Author

@github-actions

Copy link
Copy Markdown
Contributor

Privacy Review task: https://app.asana.com/0/69071770703008/1217702990722268

@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_prompt_origin branch from 8ac9c33 to 09522f8 Compare August 21, 2026 00:47
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_prompt_origin branch from 09522f8 to 6abc506 Compare August 21, 2026 20:36
@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duck_ai_entry_point_attribution branch from 20a76d0 to b94db4e Compare August 21, 2026 20:36

@malmstein malmstein left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two things before merge: page_type is resolved inside the launch, so it races the url write that the submission itself triggers, and the pending entry point has no expiry. also missing a test on the duck.ai carry-forward path, which is what this PR is for. no apk build on this head, so static only.

@YoussefKeyrouz
YoussefKeyrouz force-pushed the feature/youssef/duckai_prompt_origin branch from 6abc506 to a6a3dc9 Compare August 21, 2026 20:54

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a6a3dc9. Configure here.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants