fix(attribution): paid-medium gate in resolveChannelLabel (JS reference)#58
Merged
Merged
Conversation
A paid click whose click ID is absent (consent-stripped, or simply not on the URL) but whose utm_medium is paid (cpc/ppc/paid/paidsearch/paid_social) fell through the click-ID + email checks straight to the referrer block, where a google.com referrer matched "Google Organic" — mislabeling a paid Google visit as organic. Add a paid-medium gate: when utm_medium is in PAID_MEDIUMS, classify by utm_source → ad-network label (Google/Microsoft/Facebook/... Ads), with a coarse Paid Search / Paid Social fallback for unknown sources, BEFORE the referrer-based organic block. Widen the fbclid branch from [cpc, paid_social, paid] to the full PAID_MEDIUMS set for consistency. This file mirrors the canonical Apointoo TS classifier (apointoo-dashboard channel-classify.ts); kept in sync as a reference. Co-Authored-By: Claude Opus 4.8 (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.
Why
A paid click whose click ID is missing — consent-stripped, or just not present on the URL — but whose
utm_mediumis paid (cpc/ppc/paid/paidsearch/paid_social) fell through the click-ID + email checks straight to the referrer block, where agoogle.comreferrer matched "Google Organic". Result: a paid Google visit mislabeled as organic.Change
resolveChannelLabel(assets/js/clicutcl-attribution.js):utm_medium∈PAID_MEDIUMS, classify byutm_source→ ad-network label (Google Ads,Microsoft Ads,Facebook Ads, …), with a coarsePaid Search/Paid Socialfallback for unknown sources.fbclidbranch from[cpc, paid_social, paid]to the fullPAID_MEDIUMSset for consistency.Acceptance criteria
cpc + googlewith no click ID →Google Ads(wasGoogle Organic)medium=organic) still →Google Organiccpc + bing→Microsoft Ads;paid_social + facebook→Facebook Ads; unknown source →Paid Search/Paid Socialnode --checkpassesNote
Reference mirror of the canonical Apointoo TS classifier (
apointoo-dashboard/src/shared/lib/channel-classify.ts), where the same gate + a 9-case regression test ship in vizuh/apointoo-dashboard#228. Apointoo/tenants are JS-only; the PHPGf_Channel_Resolverwas intentionally left unchanged.🤖 Generated with Claude Code