# Group 5 — gclid vs `leadsource` (case workbook)

**Last Updated:** 2026-03-29 (retro `leadsource` PATCH applied for four contacts; one Freelancesdr row skipped)  

**Reason code:** `gclid_present` (tier **A**). See [HUBSPOT_LEADSOURCE_UTM_AUDIT_PATTERNS_SUMMARY.md](./HUBSPOT_LEADSOURCE_UTM_AUDIT_PATTERNS_SUMMARY.md).

This file tracks **per-contact** classification and **CRM action** after HubSpot UI review (merge history, workflows, ads activity). **Do not commit PII** beyond what is already in the patterns summary if you prefer IDs-only; you may keep filled rows in a private copy.

## Sub-buckets

| Code | Meaning |
|------|---------|
| **M_mergeArtifact** | Merge combined `gclid__c` from one record with `leadsource` from primary [^merge] |
| **M_workflowOverride** | Workflow changed `leadsource` after create |
| **M_intentionalSdr** | **Freelancesdr** (or similar) is correct; keep `leadsource`; `gclid__c` diagnostic only |
| **M_trueAttributionBug** | Single coherent submission; Ordio should have sent paid Google — trace endpoint + logs |

## List all Group 5 rows from an audit CSV

```bash
php v2/scripts/hubspot/filter-audit-csv-by-reason.php \
  --input=var/hubspot-audits/leadsource-utm-audit-full-90d.csv \
  --reason=gclid_present \
  --output=var/hubspot-audits/group5-gclid-only.csv
```

(Use your actual audit path after each `audit-leadsource-utm-discrepancies.php` run.)

## Proposed `leadsource` PATCH file (draft — edit before apply)

Generate **`target_leadsource`** from audit **`suggested_patch`** / **`expected_leadsource_canonical`** (same five rows for `gclid_present`):

```bash
php v2/scripts/hubspot/build-patch-csv-from-audit.php \
  --input=var/hubspot-audits/leadsource-utm-audit-full-90d.csv \
  --reason=gclid_present \
  --exclude-contact-ids=685457135815 \
  --output=var/hubspot-audits/proposed-patch-g5-leadsource.csv
php v2/scripts/hubspot/patch-leadsource-from-audit.php --input=var/hubspot-audits/proposed-patch-g5-leadsource.csv
# Or edit CSV manually; then --apply when ready
```

## Contacts (five rows — IDs from `leadsource-utm-audit-full-90d.csv`)

**Hypothesis column** = quick read of **CRM snapshot only** — confirm in HubSpot UI (merges, workflows, timeline) before PATCH.

| Contact ID | Hypothesis (data snapshot only) | Sub-bucket | CRM PATCH `leadsource` | Notes |
|------------|--------------------------------|------------|------------------------|-------|
| 609537709256 | Mixed **chatgpt** / **referral** + **gclid**; analytics AI_REFERRALS | Multi-touch; **gclid-first** policy | **Yes → Google** (2026-03-29) | Form UTMs reflect referral/AI; paid click id retained on contact — align CRM with Ordio paid-search policy |
| 685457135815 | **Freelancesdr** + **ppc** + **gclid**; analytics PAID_SEARCH | **M_intentionalSdr** | **No** | Keep **Freelancesdr** for routing; `gclid__c` stays diagnostic |
| 630893167819 | **Organic Search** + **adwords**/**ppc** + **gclid** (contradictory) | **M_trueAttributionBug** | **Yes → Google** (2026-03-29) | Clear ads signal + gclid vs wrong bucket |
| 616131856594 | **Direct** + **gclid** (unusual combo) | **M_trueAttributionBug** / capture | **Yes → Google** (2026-03-29) | gclid proves paid Google touch |
| 690047357146 | **Organic Search** + **ecosia**/**organic** + **gclid** | Multi-touch; **gclid-first** | **Yes → Google** (2026-03-29) | Analytics organic vs click id — policy: paid id wins for `leadsource` |

### Optional decision aid (not a substitute for UI review)

| Contact ID | If HubSpot timeline shows … | Consider sub-bucket |
|------------|------------------------------|---------------------|
| 685457135815 | Merge + mixed survivors; **Freelancesdr** is required for routing | **M_intentionalSdr** — remove from proposed PATCH CSV |
| 685457135815 | No SDR requirement; merge scrambled fields | **M_mergeArtifact** — PATCH **Google** if policy says ads win |
| 630893167819 | Single form submit with **adwords**/**ppc**/**gclid** | **M_trueAttributionBug** — **Google** likely |
| 609537709256 | Ad click then form with **chatgpt**/**referral** UTMs | Multi-touch — policy chooses **Google** vs keep **referral** |
| 616131856594 | **Direct** + **gclid** only | Import, merge, or URL capture — classify before PATCH |
| 690047357146 | Organic Ecosia + **gclid** | Multi-touch / measurement — classify before PATCH |

## HubSpot UI checklist (per row)

1. **Activity** — Form submissions on create day; **Ads activity**.  
2. **Merges** — Any “merged with …” events around the discrepancy.  
3. **Property history** — `leadsource`, `source__c`, `utm_medium__c`, `gclid__c`.  
4. **Workflows** — Enrollment that sets `leadsource` after submission.

## CLI dossier (read-only)

```bash
php v2/scripts/hubspot/contact-attribution-dossier.php \
  609537709256 685457135815 630893167819 616131856594 690047357146
```

## Related exclusion (Group 4, not Group 5)

Contact **668964066526** appeared under **`utm_medium_organic`** with **`leadsource` = Freelancesdr**. Same **SDR routing** rule as **685457135815**: **no PATCH** (do not set `leadsource` to Organic Search).

## References

[^merge]: [HubSpot — merge contacts](https://knowledge.hubspot.com/contacts/merge-contacts)
