Repository navigation
feat: add public API for manually tracking push notification taps #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -437,6 +437,29 @@ export class NotificationService { | |
| } | ||
| } | ||
|
|
||
| async trackPushTapped(data: Record<string, any>): Promise<void> { | ||
| const clixPayload = this.parseClixPayload(data); | ||
| if (!clixPayload) { | ||
| throw new Error( | ||
| 'No valid Clix payload found in notification data. ' + | ||
| "Ensure the notification data contains a 'clix' key with message_id, title, and body." | ||
| ); | ||
| } | ||
| this.sessionService?.setPendingMessageId(clixPayload.messageId); | ||
| await this.eventService.trackEvent( | ||
| 'PUSH_NOTIFICATION_TAPPED', | ||
| {}, | ||
| clixPayload.messageId, | ||
| clixPayload.userJourneyId, | ||
| clixPayload.userJourneyNodeId, | ||
| 'CLIX' | ||
| ); | ||
|
Comment on lines
+440
to
+456
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make tap tracking idempotent across manual and automatic handlers. This new path always emits 🤖 Prompt for AI Agents |
||
| ClixLogger.debug( | ||
| 'PUSH_NOTIFICATION_TAPPED event tracked:', | ||
| clixPayload.messageId | ||
| ); | ||
| } | ||
|
|
||
| private async trackPushTappedEvent( | ||
| payload: ClixPushNotificationPayload | ||
| ): Promise<void> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trackPushTappedreusesparseClixPayload, which rejects payloads unlessmessage_id,title, andbodyare all present; for the third-party notification use case this API targets, tap callbacks often provide only tracking identifiers indatawhile title/body live outside that object, so this path now throws and dropsPUSH_NOTIFICATION_TAPPEDevents instead of recording them. BecauseeventService.trackEventonly needs the IDs, this validation is stricter than necessary for manual tap tracking and breaks the new feature for those payload shapes.Useful? React with 👍 / 👎.