Track Lead Source in Microsoft Dynamics CRM in Four Steps
If you cannot tell whether Facebook Ads, Google Ads, search, or another campaign produced a lead, you cannot judge whether that spend deserves to continue. The setup below connects website visits to the records created in Microsoft Dynamics CRM, so channel, campaign, and landing-page context travel with each lead and customer.
Why lead-source context matters in Dynamics CRM
Start with the business question, not the CRM field. You want to know how many leads came from a particular ad platform, how many opportunities a campaign created, how much revenue followed, and which website sections or pages were involved. Without that context stored on the CRM record, later reporting has to rely on memory or guesswork.
A practical setup has four moving parts: a small website script that recognises the visit source, hidden form fields that receive the attribution values, a form submission that carries those values into Dynamics CRM, and reports built on the stored fields. Each part solves a different problem, and skipping one breaks the chain.
Step 1: Install the script and add hidden fields
First, place the attribution script on the website. It can be added directly through the site builder's settings or through a tag manager such as Google Tag Manager. The exact placement depends on the website platform, so test that the script loads on the pages containing your forms.
Next, add hidden fields to each relevant form. The core set is Channel, Channel Drilldown 1, Channel Drilldown 2, Channel Drilldown 3, and Channel Drilldown 4. Channel gives the broad category, while the drilldowns add progressively finer detail such as platform, campaign, ad, or keyword. Hidden-field steps vary by form builder, so follow the instructions for the specific tool in use.
Checklist before moving on:
- The script is present on form pages.
- Every lead form has the same hidden-field names.
- A test submission creates a CRM record with those fields populated.
- Field labels in the CRM match the values the script writes.
Step 2: Capture the channel at the visit, then fill the form
When a visitor arrives, the script examines the referral information and groups the visit into a channel such as Organic Search, Paid Search, or Paid Social. That classification is stored in a browser cookie, which matters because the visitor may browse several pages before completing a form.
When the visitor submits a form, such as a contact or quote-request form, the script populates the hidden fields with the stored channel information. This is the handoff point: attribution is captured at the moment of conversion rather than reconstructed later from separate analytics data.
Step 3: Send the values into Dynamics CRM with the submission
On submission, the form tool sends both the visitor's details and the hidden-field values to Microsoft Dynamics CRM. The workflow is compatible with Dynamics Marketing forms and with common external form builders, including Gravity Forms, Typeform, Jotform, and Webflow forms, provided the hidden fields are configured in that builder.
A useful distinction is between the form builder and the CRM. The builder collects the submission; Dynamics CRM stores it alongside the lead, contact, opportunity, and customer records. If a field is missing from the form, it cannot be recovered later from the CRM record alone.
Step 4: Report on leads, opportunities, and customers
Once the attribution fields sit on CRM records, reporting becomes a matter of grouping and filtering. You can count leads by channel, opportunities by campaign, and customers by advertising network, and you can connect those counts to revenue where the CRM records support it.
Before building dashboards, decide which questions the reports must answer. Examples include how many leads a Facebook campaign produced, how many customers came from Google Ads, and how much revenue originated from organic search. Defining those questions first keeps the channel hierarchy from becoming an unstructured list of labels.
What data should reach Dynamics CRM
Channel data resembles the channel reporting familiar from analytics tools. The top-level Channel value might be Paid Search, Paid Social, or Organic Search. Drilldowns then identify the platform, campaign, and more specific item.
Consider a paid search visit through Bing for a Dynamics CRM promotion. A complete record might show Channel as Paid Search, Channel Drilldown 1 as Bing, Channel Drilldown 2 as the brand campaign, and Channel Drilldown 3 as the free-trial ad. An organic Bing visit would instead show Channel as Organic Search, with drilldowns recording Bing, the specific Bing domain, and the search term where available.
Landing-page data adds a second dimension. Alongside the channel fields, capture the first page the visitor landed on and a broader landing-page group. For example, an individual product page can roll up into a product-pages group. That structure supports both page-level reporting and section-level reporting, so you can compare whole areas of the site without losing the detail behind them.
Three reports to build first
A leads-by-channel report gives the broadest view. If organic search produces most leads while paid search consumes most of the budget, the mismatch is visible immediately and the allocation of time and money deserves review.
An opportunities-by-campaign report goes one level deeper for paid search. Grouping opportunities by Google Ads campaign by month shows which campaigns create sales opportunities and which ones may be candidates for pausing or restructuring.
A customers-by-network report is useful when social advertising runs across several properties. Breaking customers down across Facebook, Instagram, Messenger, and WhatsApp shows where budget is producing customers rather than only clicks or leads.
Together, the three views answer different questions: where demand originates, which campaigns create pipeline, and which networks create customers. Use all three before shifting budget, because a channel can look strong on leads while a specific campaign or network performs better on opportunities or customers.