fix(attribution): group Snag referral codes as 'Snag Referrals'#8
Open
Crypt0Shmipt0 wants to merge 1 commit into
Open
fix(attribution): group Snag referral codes as 'Snag Referrals'#8Crypt0Shmipt0 wants to merge 1 commit into
Crypt0Shmipt0 wants to merge 1 commit into
Conversation
…' source
The 6-char alphanumeric values dominating the channels list (axeheq, 9pu7bd,
3VAN8Y, etc.) are all Snag referral codes from ?ref=XXX URLs. Sprint 2.0
backfill wrote them into first_utm_source for many profiles, so they were
showing as 50 separate pseudo-channels AND inflating the withUtm count.
Backend changes (3 places):
- computeChannelROI: CASE matching ^[a-zA-Z0-9]{6}$ collapses all referral
codes into 'snag_referrals' (single channel row instead of long tail)
- computeAttributionCoverage: codes matching the 6-char pattern are
reclassified — counted toward 'withReferralOnly', NOT 'withUtm'.
Expected effect: percentWithUtm drops from 66.5% (lie) to ~the real
Sprint 2.3 stitch rate (likely <1% on day 1)
- computeTopCampaigns: defensive filter excludes the 6-char pattern from
campaign field too
Frontend:
- formatSource() helper translates 'snag_referrals' → 'Snag Referrals' and
'direct' → 'Direct' for display. Real UTM sources pass through unchanged.
Tests: backend 66/66 pass, frontend 48/48 pass, both builds clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Diagnosis (from Tomer)
The 6-char alphanumeric values dominating the channels list (
axeheq,9pu7bd,3VAN8Y, etc.) are all Snag referral codes that arrive via?ref=XXXURLs. Example:https://airdrop.shiftrwa.xyz/register?ref=3VAN8Y.Sprint 2.0 backfill captured these and wrote them into
first_utm_sourcefor many profiles. Result:percentWithUtminflated to 66.5% (still a lie — most of those are referrals not UTMs)Fix
Backend regex
^[a-zA-Z0-9]{6}$collapses all 6-char codes:computeChannelROIsnag_referralsinstead of 50+ rowscomputeAttributionCoveragewithReferralOnly, NOTwithUtmcomputeTopCampaignsFrontend
formatSource()mapssnag_referrals→ "Snag Referrals" for display.Expected outcome after deploy
Tests
Test plan
/api/attribution/overview→ channels hassnag_referralsrow, no 6-char rows🤖 Generated with Claude Code