Track marketing notification opens#6067
Open
peachbits wants to merge 2 commits into
Open
Conversation
Recognize a marketing push payload (type 'marketing' with a campaignId and optional deep-link url) in parsePushMessage. When the user opens the app from one, report a Marketing_Notification_Opened event carrying the campaignId to analytics, and navigate to the deep link when present. Unrecognized or malformed urls degrade to track-only. Includes a parser unit test.
| // Only navigate for a recognized Edge deep link. `parseDeepLink` is | ||
| // lenient and returns an `other` link for anything it does not know, so | ||
| // an unrecognized or malformed URL degrades to track-only. | ||
| if (parsed.type !== 'other') link = parsed |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: MEDIUM
The marketing push path accepts any recognized deep link type from message.data.url and forwards it into the shared deep-link dispatcher. This means a marketing payload is not constrained to benign campaign destinations and can invoke broader in-app actions.
Impact: A compromised or misconfigured campaign sender could cause notification opens to trigger higher-risk flows (for example auth/session or internal navigation handlers) instead of only safe marketing navigation.
Reviewed by Cursor Security Reviewer for commit b4eafc8. Configure here.
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.


CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Requirements
If you have made any visual changes to the GUI. Make sure you have:
No visual changes — this is push-payload parsing plus navigation/analytics, no new UI.
Description
Recognizes a marketing push notification and, when the user opens the app from it, reports the campaign open to analytics and navigates to an optional deep link.
parsePushMessagenow recognizes a{ type: 'marketing', campaignId, url? }FCMdatapayload and returns a newMarketingLinkdeep-link type. An unrecognized or malformedurldegrades to track-only.Marketing_Notification_OpenedPostHog event carrying thecampaignId, then navigates to the optional deep link through the existing handler.PushMessageParserunit test.Verified with the unit test and end-to-end on a real Android device against a local push server: the open was tracked in PostHog and the deep link navigated.
The sending side lives in edge-push-server (companion PR EdgeApp/edge-push-server#78). This PR is the receiving side and is safe to merge on its own — it only acts on notifications that carry the marketing payload.
Note
Low Risk
Opt-in behavior on a new FCM payload type; analytics plus optional navigation with defensive fallbacks—no auth, payments, or existing push flows altered beyond additive marketing handling.
Overview
Adds end-to-end handling when a user opens the app from a marketing FCM push: the payload
{ type: 'marketing', campaignId, url? }is turned into a newMarketingLinkdeep-link type, analytics recordsMarketing_Notification_OpenedwithcampaignId, and an optionalurlis parsed for navigation through the existing deep-link handler (same pattern as affiliate links).parsePushMessagenow recognizes marketingdataafter price-change handling. Recognized Edge URLs become a nestedlink; unknown or malformed URLs (includingotherfrom lenient parsing) and parse errors degrade to track-only so opens are still counted. Price-change parsing is unchanged.Adds
PushMessageParserunit tests and acampaignIdtracking field for the new event.Reviewed by Cursor Bugbot for commit b4eafc8. Bugbot is set up for automated code reviews on this repo. Configure here.