feat(analytics): track received tips and messages, tip origin, display name, and token symbols - #1304
Merged
Merged
Conversation
Tip Received and Message Received fire when the user's READ pointer crosses an inbound message, not when it is delivered — delivery is a device fact, crossing the pointer is a user fact. The pointer is read before it is written, so a re-read or a backwards jump crosses nothing and emits nothing.
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.
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 messageTips Received Value— + the USD-normalised value of that tipMessages 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
analyticsCountedThroughwatermark (new column onChatMetadataEntity, 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) andMessage 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 onlyTip Received.OriginonSent TipExisting
Sent Tipnow carriesOrigin:TipcardorChat, 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 SetandDisplay Name Updated, both carryingSource(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 getsSet. Single emit point inNameEntryViewModel; the screens just pass their source.Token Symbolalongside every mintEvery event that carries
Mintnow also carriesToken Symbol, andPayment MintgainsPayment Token Symbol. Resolution happens centrally in the analytics layer via aTokenSymbolResolverbacked 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
EventStreamDelegate,MessagingDelegate) rather than a new coordinator, keeping the ingestion path in one place.