Tutorial

How to Design Lead Source Attribution in a Custom CRM

Lead source attribution only holds up when the CRM stores raw touch data as events and derives credit later. Here is the data model to copy.

Lead source attribution in a custom CRM comes down to one design decision: store every touchpoint, meaning each individual interaction between a person and your marketing or sales effort, as its own record and compute credit later. A custom CRM here is the system of record for contacts, companies, and deals, and it should derive attribution rather than store one source value on the contact. Get that structure right and any attribution model becomes a query you can rerun.

Why touchpoints beat a single source field

Most off-the-shelf and homegrown CRMs record one source on the lead and call it done. That choice is made at write time, by whoever built the form, and it is close to permanent. Form fills, ad clicks, webinar signups, inbound emails, and cold calls are all touchpoints, and a single field can only ever hold one of them.

A touchpoint table changes the shape of the problem. Each row holds one interaction with a timestamp, a channel, and a campaign reference. Credit is computed by querying those rows under whatever rule you choose this quarter. When marketing wants to argue about first touch versus last touch, nobody has to migrate data.

The table grows faster than the contact table, typically three to five times faster once ads and email are instrumented. That is not a problem. These rows are narrow, mostly identifiers and timestamps, and a few million of them cost less to store than the deals they describe.

What fields does a lead need for source attribution?

Five stored values cover every model: the channel, the specific campaign, the raw referring URL, the timestamp of first capture, and a link to the touchpoint that created the record.

Split those into two kinds of column. Captured fields are written by the system and never edited: the landing URL, the UTM parameters, the referrer, the user agent, the timestamp. Derived fields are computed for reporting: channel, campaign, first-touch source, last-touch source. Reps and admins should be able to read both and edit neither.

Define the terms once, at the data layer:

  • Channel: the broad bucket, such as paid search, organic, referral, event, or outbound. Roughly ten values, no more.
  • Campaign: the specific initiative, linked by ID to a campaign registry table rather than typed as text.
  • UTM parameters: tags appended to a link, such as utm_source and utm_campaign, that identify which campaign sent the click.
  • Referrer: the URL of the page a visitor was on before arriving at yours, sent by the browser.
  • Touchpoint: one interaction record, linked to the contact and stamped with a time.

A campaign registry table is the piece most teams skip. It holds one row per campaign with an ID, an owner, a start date, a channel, and a status. Leads point at the ID. This is what stops three variants of a webinar name from becoming three separate campaigns in your reports.

Which attribution model should a custom CRM default to?

Default to first touch stored as a fact and last touch stored beside it. First touch tells you where demand came from, last touch tells you what closed the deal, and small teams need both before anything fancier.

ModelCredit ruleWhere it fitsWhere it misleads
First touchAll credit to the earliest touchpointContent and outbound motions with cycles of 60 days or moreIgnores the asset that actually converted
Last touchAll credit to the final touchpoint before conversionShort funnels with one or two stepsOverweights branded search and direct visits
LinearSplit evenly across all touchpointsEarly discovery when most leads carry under five touchesFlattens the difference between a webinar and a banner
Position basedRoughly 40% first, 40% last, 20% spreadBalanced B2B reportingHarder to explain to a sales team
Custom weightedWeights you assign per channelTeams with a marketing ops ownerWeights drift and rarely get revisited

The practical advice: store the raw data so you can compute all five, and pick one to show in the dashboard. Teams that commit to a single model at the schema level usually want a different one within a year, and by then the old touchpoints are gone.

How do you capture the source when the form is the only touchpoint?

Read the landing URL, the UTM parameters, and the referring page on the first page load, write them into hidden form fields, then persist them on the lead before any enrichment or deduplication runs.

Order matters here, and it is where most implementations leak. Enrichment means appending outside data such as company size or industry to a record, and deduplication means finding and merging records that describe the same person. A workable sequence:

  1. On page load, read the query string, the document referrer, and the current URL. Push them into a first-party cookie, meaning a small file your own domain sets, along with a timestamp.
  2. On submit, copy those values into hidden fields on the form payload. Do not rely on the browser keeping them between pages.
  3. On the server, write the touchpoint row before the lead record, so the lead can point at it.
  4. After both rows exist, run enrichment and deduplication. Merging first destroys the association you just made.

Consent rules vary by jurisdiction, so confirm what you may store before designing around it. A first-party cookie holding a campaign string for 90 days is a different question from a third-party tracking pixel, and the answer changes by region.

How should offline and sales-sourced leads be attributed?

Give every offline channel the same field names as your digital ones, then require a source and an owner on any manually created record so referrals, events, and outbound calls land in named buckets.

The alternative is a dropdown that defaults to unknown and gets left there. In a CRM that has run for two or more years, it is common to find roughly 15 to 25% of records with no usable source, and most of that is manual entry. The fix is structural, not motivational: a required field with a short list of options, plus an owner so the record has an accountable human.

Offline sources need one extra column that digital ones do not: the person or channel partner who generated the lead. Referral attribution without that column is just a label.

Where do custom CRMs usually break attribution?

Three places, mostly: reps editing the source field during qualification, duplicate merges letting the newest record win, and campaign names that drift every quarter until nobody can group them in a report.

Each has a cheap guard. Make captured fields read-only at the permission level, not just visually greyed out. Configure merges so the oldest record survives and the newest touchpoint is appended rather than replacing history. Enforce the campaign registry as the only way to attach a campaign, with a hard block on free text.

A fourth failure is quieter. Attribution gets built, reports go out for two quarters, then a schema change breaks the derivation and nobody notices because the numbers still look plausible. Add a monthly job that counts records with a null first touchpoint. A jump means something upstream broke.

How long does a rollout take?

A small team can usually ship this in roughly four to eight weeks: one week on taxonomy, one to two on capture, one to three on backfill, and one on reporting.

Rollout order matters more than speed:

  1. Taxonomy first. Agree the channel list and campaign naming rules in a document, not in the CRM. This takes days and prevents months of cleanup.
  2. Campaign registry second. Load current and recent campaigns with IDs before any lead points at them.
  3. Capture instrumentation third. Forms, landing pages, and every manual entry path. Test each with a real submission.
  4. Backfill last, and only where it is defensible. Historical records rarely have recoverable touchpoints. Mark backfilled values as backfilled so reports can exclude them.
  5. Reports after that. Build the first-touch and last-touch views once the data is clean. Building them earlier means rebuilding them.

If you are scoping a build, the touchpoint table and campaign registry belong in the first phase of a custom CRM rather than in a later enhancement. Retrofitting attribution two or three years after launch typically costs two to three times what capturing it correctly at the start would have cost, mostly in manual reconstruction that still ends up incomplete.

Launch checklist

Before you call the schema done, confirm each of these:

  • Captured fields are written by the system and locked against edits.
  • Every lead links to the touchpoint that created it.
  • Channels are a fixed list of about ten values.
  • Campaigns attach by ID to a registry row, never by typed text.
  • Manual entry requires a source and an owner.
  • Merge rules preserve the oldest record and append history.
  • Backfilled records are flagged and excluded from primary reports.
  • A monthly job counts records with a null first touchpoint and alerts on change.

The number to watch after launch is the share of new records arriving with a complete source at creation. Hold it above roughly 95% and every report built on top stays auditable. Let it slide below 85% and you are back to guessing, just with more columns.

Frequently asked questions

What is lead source attribution in a CRM?

It is the practice of recording which channel and campaign produced each lead, then using those records to decide which marketing effort deserves credit. In a custom CRM it should be derived from stored touchpoints rather than typed into a single field, because a derived value can be recomputed when your model changes.

What is the difference between first touch and last touch attribution?

First touch gives all credit to the earliest interaction that brought someone into your system, while last touch gives it to the final interaction before they converted. First touch is better for judging demand generation, last touch is better for judging what closes deals, which is why storing both is worth the small amount of extra schema work.

Should I use UTM parameters or hidden form fields for tracking?

Both, in sequence. UTM parameters arrive on the URL and identify the campaign, while hidden fields carry those values through the form submission so the CRM receives them even when the visitor converts on a later page or a second visit.

How do I handle leads that arrive by phone or referral?

Require a source and an owner on every manually created record, and give offline channels the same field names as your digital ones. A required dropdown with about ten options beats a free-text field that quietly defaults to unknown for most of the year.

Back to blog