Skip to content

P-2069 unify mobile screen events as page type #12

Merged
yosriady merged 3 commits intomainfrom
p-2069
Apr 9, 2026
Merged

P-2069 unify mobile screen events as page type #12
yosriady merged 3 commits intomainfrom
p-2069

Conversation

@yosriady
Copy link
Copy Markdown
Contributor

@yosriady yosriady commented Apr 9, 2026

Screen events from the React Native SDK now send type="page" instead of type="screen", with screen name mapped to page_title, page_path, and page_url context fields. This allows Tinybird's process_sessions and process_sources materializations (which filter on type='page') to include mobile screen views. The channel="mobile" field distinguishes mobile from web traffic.


Open with Devin

Screen events from the React Native SDK now send type="page" instead of
type="screen", with screen name mapped to page_title, page_path, and
page_url context fields. This allows Tinybird's process_sessions and
process_sources materializations (which filter on type='page') to include
mobile screen views. The channel="mobile" field distinguishes mobile from
web traffic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear bot commented Apr 9, 2026

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@yosriady yosriady changed the title P-2069 unify mobile screen events as page type for Tinybird compatibility P-2069 unify mobile screen events as page type Apr 9, 2026
Comment on lines +389 to +394
const screenContext: IFormoEventContext = {
...(context ?? {}),
page_title: name,
page_path: `/${name}`,
page_url: `app://${name}`,
};

This comment was marked as outdated.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

⚠️ 1 issue in files not directly in the diff

⚠️ getActionDescriptor screen branch is now dead code due to type change from "screen" to "page" (src/utils/helpers.ts:113-115)

The PR changes the event type for screen events from "screen" to "page" in EventFactory.generateScreenEvent (src/lib/event/EventFactory.ts:398), but the getActionDescriptor helper at src/utils/helpers.ts:113 still checks for type === "screen". Since screen events now have type: "page", this branch will never match, and EventQueue.enqueue at src/lib/event/EventQueue.ts:168 will log "Event enqueued: page" instead of the more descriptive "Event enqueued: screen:HomeScreen". The screen name is lost from debug logs.

View 3 additional findings in Devin Review.

Open in Devin Review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the EventFactory to map mobile screen view events to page-equivalent context fields, enabling unified analytics processing in Tinybird. The review identified an issue where the new context fields were overwriting existing values provided in the input; a suggestion was provided to prioritize the existing context and improve URI safety.

Comment on lines +389 to +394
const screenContext: IFormoEventContext = {
...(context ?? {}),
page_title: name,
page_path: `/${name}`,
page_url: `app://${name}`,
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The current implementation of screenContext overwrites any page_title, page_path, or page_url fields that might have been explicitly provided in the context argument. It is better to allow manually provided context to take precedence over these defaults. Additionally, consider that if the screen name contains spaces or special characters, the resulting page_url and page_path might not be valid URIs; you might want to ensure they are properly encoded (e.g., using encodeURIComponent).

Suggested change
const screenContext: IFormoEventContext = {
...(context ?? {}),
page_title: name,
page_path: `/${name}`,
page_url: `app://${name}`,
};
const screenContext: IFormoEventContext = {
page_title: name,
page_path: `/${name}`,
page_url: `app://${name}`,
...(context ?? {}),
};

yosriady and others added 2 commits April 9, 2026 21:01
… events

User-provided context values for page_title, page_path, and page_url
were being silently discarded because the defaults were spread after the
user context. Reversed the spread order so user values take precedence,
consistent with how generateContext() handles merging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tinybird derives page_path from page_url via path(), so setting it
in the SDK is redundant and never read.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yosriady yosriady merged commit e840861 into main Apr 9, 2026
6 checks passed
@yosriady yosriady deleted the p-2069 branch April 9, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant