Skip to content

feat(analytics): add Chat Blast: Message Viewed event#14534

Open
dylanjeffers wants to merge 1 commit into
mainfrom
feat/blast-message-viewed-event
Open

feat(analytics): add Chat Blast: Message Viewed event#14534
dylanjeffers wants to merge 1 commit into
mainfrom
feat/blast-message-viewed-event

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

What

Adds a new Amplitude analytics event, Chat Blast: Message Viewed, that fires when a user opens a DM thread that is a blast (chat.is_blast === true).

Previously the only blast recipient-side event was Chat Blast: CTA Clicked; there was no signal for a user actually opening the blast thread. This tracks opens.

Behavior

  • Fires once per blast per user — not on every re-open. Dedup is keyed on the blast chat_id, persisted in localStorage (web) / AsyncStorage (mobile).
  • Fires on both web (ChatPage) and mobile (ChatScreen), mirroring the existing track(make(...)) pattern used by CHAT_BLAST_MESSAGE_SENT.

Event properties

Property Notes
isNativeMobile false on web, true on mobile (existing convention)
chatId The blast thread's chat_id (the recipient-side blast identifier; the client ChatBlast type has no separate blast_id)
audience Blast audience type
audienceContentType track / album when scoped to content
audienceContentId Decoded via OptionalHashId.parse to a numeric ID, matching CHAT_BLAST_MESSAGE_SENT

Changes

  • packages/common/src/models/Analytics.ts — add CHAT_BLAST_MESSAGE_VIEWED to the Name enum, add the ChatBlastMessageViewed type, and register it in the AllTrackingEvents union.
  • packages/web/src/pages/chat-page/ChatPage.tsxuseEffect that fires the event on opening a blast thread, deduped via localStorage.
  • packages/mobile/src/screens/chat-screen/ChatScreen.tsx — same, deduped via AsyncStorage.
  • packages/mobile/src/constants/storage-keys.ts — new VIEWED_BLAST_CHATS_KEY.

Testing

  • tsc typecheck passes for common, web, and mobile.
  • eslint clean on all changed files.

🤖 Generated with Claude Code

Fires an Amplitude "Chat Blast: Message Viewed" event the first time a
user opens a blast DM thread (detected via chat.is_blast), once per blast
per user. Adds the event on both web (ChatPage) and mobile (ChatScreen),
deduping via localStorage / AsyncStorage keyed on the blast chat id.

Properties: isNativeMobile, chatId, audience, audienceContentType,
audienceContentId.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ce8c23a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant