Skip to content

feat(analytics): track received tips and messages, tip origin, display name, and token symbols - #1304

Merged
bmc08gt merged 8 commits into
code/cashfrom
feat/analytics-received-events
Aug 21, 2026
Merged

feat(analytics): track received tips and messages, tip origin, display name, and token symbols#1304
bmc08gt merged 8 commits into
code/cashfrom
feat/analytics-received-events

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Adds the receive-side analytics we were missing, plus a few adjacent gaps found along the way. Spec covers both platforms; this is the Android half (iOS lands separately).

What's new

Received tips and messages (people counters)
Three Mixpanel people properties, incremented as inbound messages land in the event stream:

  • Tips Received — +1 per inbound tipped Cash message
  • Tips Received Value — + the USD-normalised value of that tip
  • Messages Received — +1 per inbound message of any type (a tip bumps both)

People properties are cumulative and unreversible, so double-counting is permanent. Each chat carries an analyticsCountedThrough watermark (new column on ChatMetadataEntity, Room schema 30) holding the highest message id already counted; the counter loop only credits messages above it and the watermark only moves forward. It seeds from the initial-sync high-water mark, so this is prospective — existing history is never retro-counted.

Chat cash arrives in the sender's native currency. If no exchange rate is cached for that currency we still increment the count but skip the value — an understated total is recoverable later, a wrong one is not.

Received events
Tip Received (Chat Type, Fiat, Currency, Mint, Token Symbol, Quarks) and Message Received (Chat Type), emitted one per inbound message as the self read pointer advances, over the half-open interval (previousPointer, newPointer]. The two are mutually exclusive — a tip emits only Tip Received.

Origin on Sent Tip
Existing Sent Tip now carries Origin: Tipcard or Chat, so subsequent payments from the money button inside a tip chat are distinguishable from the first tip off the tip card.

Display name events
Display Name Set and Display Name Updated, both carrying Source (Onboarding, My Account, Tip Card Setup). Set-vs-updated is decided by whether a prior name existed, not by which screen you came from — someone who skips onboarding and names themselves from the tip card still gets Set. Single emit point in NameEntryViewModel; the screens just pass their source.

Token Symbol alongside every mint
Every event that carries Mint now also carries Token Symbol, and Payment Mint gains Payment Token Symbol. Resolution happens centrally in the analytics layer via a TokenSymbolResolver backed by the token coordinator's cache; when a mint isn't cached the property is omitted entirely rather than sent empty.

Hex identity, matching iOS
UserManager.associate() now identifies to Mixpanel with the lowercase hex of the account id instead of base58. iOS has always sent hex, so the same human was two Mixpanel profiles. Android moves; iOS does not.

Notes for review

  • Room schema 30 adds one nullable column and ships a migration + schema json — no destructive migration.
  • The counter loop and the read-pointer emitter both live in existing chat delegates (EventStreamDelegate, MessagingDelegate) rather than a new coordinator, keeping the ingestion path in one place.
  • The identity change means historical Mixpanel data for Android users stays attached to the old base58 distinct id. New activity accrues to the hex profile.

@github-actions github-actions Bot added area: network gRPC, connectivity, API, exchange rates area: onboarding type: feature New functionality labels Aug 21, 2026
@bmc08gt
bmc08gt merged commit 79a4c4f into code/cash Aug 21, 2026
3 checks passed
@bmc08gt
bmc08gt deleted the feat/analytics-received-events branch August 27, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: network gRPC, connectivity, API, exchange rates area: onboarding type: feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant