To track lead attribution in a CRM, capture eligible UTM parameters when a visitor arrives, save the first and most recent campaign touches, and attach that snapshot to the enquiry when the form is submitted. An AWS implementation can use API Gateway to receive the form, AWS Lambda to validate the attribution fields, and DynamoDB to store them with the lead before sending it to the CRM.
This lets marketing answer two questions about one enquiry: which observed campaign introduced the prospect, and which observed campaign brought them back before they contacted sales?
Which attribution fields should you capture?
- First campaign touch records the earliest eligible campaign observed within your lookback window.
- Last known campaign touch records the most recent eligible campaign before submission.
- Submission context records the page and form where the visitor became a lead.
- Attribution policy version records which rules produced the snapshot, including how untagged visits were handled.
For each campaign touch, start with utm_source , utm_medium , utm_campaign , and the observation timestamp. Keep the form ID and landing page path as separate fields. This lets you compare campaign performance and form performance without mixing the two.
1. Decide what happens across multiple visits
Imagine a visitor first finds your CRM service through a LinkedIn campaign. Two days later, they return through a Google ad. On Friday, they open a saved page and submit an enquiry. The submission visit has no UTM tags.
Visit | Observed campaign | Attribution effect |
|---|
Monday | linkedin / paid_social / crm_launch | Records the first campaign touch |
Wednesday | google / cpc / crm_integration | Updates the last known campaign touch |
Friday | Untagged visit to the CRM enquiry form | Records the submission page and preserves the earlier campaign data |
In this example, the policy uses a 30-day window. If the last campaign falls outside that window, store its attribution as UNKNOWN . Use the same value when eligible tracking data is missing. A user may have switched devices, arrived through an untagged link, or declined the tracking needed to retain the earlier visit.
2. Save the attribution snapshot with the enquiry
Collect only the permitted campaign fields and retain them across visits according to the site’s consent settings. When the visitor submits the form, send the current snapshot with the enquiry and its submission ID.
Lambda should validate allowed fields and length limits before saving the lead. Browser-supplied UTM values describe observed marketing context. Where the marketing team maintains a campaign registry, match incoming campaign identifiers against that registry before using them in budget reports.
Save the snapshot with the original enquiry. If the browser times out and retries with the same submission ID and payload, return the result for the saved submission. This prevents a retry from creating a duplicate lead or replacing its original attribution.
3. Keep campaign data attached to the right CRM record
One person can submit a CRM integration enquiry in March and a data migration enquiry in June. Both enquiries can belong to the same contact while carrying different campaign data.
- Store the original acquisition source on the contact if your CRM needs a long-term source field.
- Store the campaign snapshot on the enquiry or opportunity.
- Use a stable external submission reference when the CRM supports it.
- Track pending and failed CRM sync separately so the AWS record can be reconciled after an outage.
Before launch, test an untagged return visit, an expired touch, disabled tracking, and a retry after a CRM timeout. Then compare accepted enquiries and qualified opportunities by campaign. A campaign with fewer form fills can still produce more opportunities that sales wants to pursue.
Loading article