feat(tracking): add vendor-neutral userInteraction tracking abstraction#2937
feat(tracking): add vendor-neutral userInteraction tracking abstraction#2937manaswinidas wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Add a concepts/userInteraction module that provides a non-opinionated tracking API (trackFormEvent, trackLinkEvent, trackSimpleEvent, trackPageEvent) via React context. The default implementation logs to console in development and is a no-op in production. Downstream integrations (e.g., ODH with Segment) can inject their own implementation via the exported UserInteractionProvider component, enabling analytics without introducing vendor-specific dependencies upstream. Signed-off-by: manaswinidas <dasmanaswini10@gmail.com> Co-authored-by: Cursor <cursoragent@cursor.com>
ab900ed to
3ad4221
Compare
| }; | ||
|
|
||
| export type LinkTrackingEventProperties = { | ||
| from?: string; |
There was a problem hiding this comment.
Tracking tools should already capture the current URL for all events. It seems redundant to have the caller supply this.
| href?: string; | ||
| to?: string; |
There was a problem hiding this comment.
What's the different between href and to?
| type?: string; | ||
| section?: string; | ||
| name?: string; |
There was a problem hiding this comment.
These need documentation. It's not clear to me how these should differ from the event name.
Description
Add a
concepts/userInteractionmodule that provides a non-opinionated tracking API via React context. This enables downstream integrations (e.g., ODH with Segment) to inject their own analytics implementation without introducing vendor-specific dependencies upstream.What's included
trackingTypes.tsTrackingOutcomeenumUserInteractionContext.tsuseUserInteraction.tsUserInteractionProvider.tsxapiindex.tsAPI
trackFormEvent(name, props)trackLinkEvent(name, props)trackSimpleEvent(name, props?)trackPageEvent()How downstream uses it
Downstream (e.g., ODH) injects a Segment-backed implementation via
UserInteractionProvider:Design decisions
DEV_MODE: Imports from~/app/utilities/constrather than redefining.Testing
npx tsc --noEmit)npx eslint)