Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Validate required mode and domain fields before queueing malformed events.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds tracker.trackAgentButtonClick for the ai_agent_button_click Behavioral API v2 event.
Changes:
- Implements event tracking and parameter mapping.
- Adds TypeScript declarations.
- Adds tracker tests.
File summaries
| File | Changes |
|---|---|
src/types/tracker.d.ts |
Exposes the new method and parameter types. |
src/modules/tracker.js |
Implements the event; required mode and domain validation is still needed before queueing. |
spec/src/modules/tracker.js |
Tests request parameters and network behavior. |
Review details
- Files reviewed: 2/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
HHHindawy
reviewed
Sep 16, 2026
| bodyParams.page_type = pageType; | ||
| } | ||
|
|
||
| if (instanceId) { |
Contributor
There was a problem hiding this comment.
I know the instanceId is 1-based, but nothing stops you from passing a 0. Should we throw an error in that case, or are we fine with silently ignoring it?
HHHindawy
previously approved these changes
Sep 16, 2026
…t_button_click API - Send the agent experience as agent_domain to match the Behavioral API v2 field (domain is reserved for the integration hostname in agent_overview events) - Narrow mode to the strict enum: chat, search, qna, recommendations, query_refinement - Add search to pageType Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Mudaafi
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
tracker.trackAgentButtonClickto send the newai_agent_button_clickbehavioral event (Behavioral API v2). It tracks clicks on CTAs that open or start an agent experience, so we can measure ASA entry points and click-to-submit conversion.Backend: Constructor-io/autocomplete#12668
The payload matches the final API from the backend PR:
agentDomain→agent_domain.domainis kept for the integration hostname inagent_overview_*events, so the two don't get mixed up.modeis a strict enum on the backend. It's narrowed in the TS types; at runtime the JS only checks that it's a string.searchis added topageTypefor the SRP.modeandagentDomainare required, andinstanceIdhas to be an integer ≥ 1. If any of these checks fail, the method returns anErrorand nothing is queued.