Skip to content

fix(attribution): paid-medium gate in resolveChannelLabel (JS reference)#58

Merged
Atroci merged 1 commit into
mainfrom
fix/channel-resolver-paid-medium-gate
Jun 5, 2026
Merged

fix(attribution): paid-medium gate in resolveChannelLabel (JS reference)#58
Atroci merged 1 commit into
mainfrom
fix/channel-resolver-paid-medium-gate

Conversation

@Atroci

@Atroci Atroci commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Why

A paid click whose click ID is missing — consent-stripped, or just not present 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". Result: a paid Google visit mislabeled as organic.

Change

resolveChannelLabel (assets/js/clicutcl-attribution.js):

  • Add a paid-medium gate before the referrer/organic block: when utm_mediumPAID_MEDIUMS, classify by utm_source → ad-network label (Google Ads, Microsoft Ads, Facebook Ads, …), with a coarse Paid Search / Paid Social fallback for unknown sources.
  • Widen the fbclid branch from [cpc, paid_social, paid] to the full PAID_MEDIUMS set for consistency.

Acceptance criteria

  • cpc + google with no click ID → Google Ads (was Google Organic)
  • genuinely organic Google (medium=organic) still → Google Organic
  • cpc + bingMicrosoft Ads; paid_social + facebookFacebook Ads; unknown source → Paid Search/Paid Social
  • node --check passes

Note

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 PHP Gf_Channel_Resolver was intentionally left unchanged.

🤖 Generated with Claude Code

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>
@Atroci
Atroci merged commit 8b521b9 into main Jun 5, 2026
6 of 8 checks passed
@Atroci
Atroci deleted the fix/channel-resolver-paid-medium-gate branch June 5, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant