Skip to content

How to Track Facebook Ads in Microsoft Dynamics CRM

If your Facebook Ads bring in leads but Microsoft Dynamics CRM cannot tell you which campaign produced them, you cannot compare paid social with search, referrals or direct traffic. This guide shows a four-step setup: install the attribution script, tag every ad URL, let the form capture the campaign data, and report on it inside Dynamics CRM. It also explains how to tell a tagging failure apart from a CRM delivery failure, and what each captured field is for.

What you can learn once Facebook Ads data reaches Dynamics CRM

Once each lead carries its campaign origin into Dynamics CRM, you can answer questions that ad-platform dashboards alone cannot answer:

  • How many leads arrived from Facebook Ads, and how does that compare with Google Ads, SEO or direct traffic?
  • Which Facebook campaigns produce the most opportunities?
  • What is the close rate of Facebook-sourced opportunities versus opportunities from other channels?
  • How much closed-won revenue came from Facebook Ads, and how does that compare with ad spend?

Without this link, two opposite mistakes are possible. A profitable campaign may go unnoticed and never receive more budget. An unprofitable one may keep consuming spend because nobody can see that it never converts into customers. The setup below closes that gap.

How the attribution layer works

A small script on your website reads the technical data that describes how each visitor arrived. It classifies the visit into a marketing channel such as Paid Social, Paid Search, Organic Search or Direct, and stores that classification in a cookie in the visitor's browser. When the visitor submits a form, the script writes the classification into hidden fields you have added to the form. Those fields travel with the rest of the submission into whatever backend is connected to the form, including Microsoft Dynamics CRM and third-party analytics tools.

The practical consequence is that the campaign information is attached at the moment of conversion, not reconstructed later from ad-platform totals.

Step 1: Install the script and add hidden fields

Sign up for the trial and place the supplied code on your website. You can add it directly through your site settings or deploy it with a tag manager such as Google Tag Manager.

Next, add these hidden fields to every lead-capture form that should carry campaign data:

  • Channel
  • Channel Drilldown 1
  • Channel Drilldown 2
  • Channel Drilldown 3
  • Channel Drilldown 4

Most form builders let you drag a Hidden field type into the form or mark a normal field as hidden in its settings. The exact method varies by tool, so follow the form builder's own documentation for hidden fields.

Step 2: Tag every Facebook ad URL with UTM parameters

UTM parameters are text appended to the destination URL. They tell the attribution script which campaign, ad set and ad sent the visitor.

A consistent convention for Facebook Ads is:

  • utm_medium = paid social
  • utm_source = facebook
  • utm_campaign = the campaign name
  • utm_term = the ad set name
  • utm_content = the specific ad

For example, a destination page of https://roipaths.com/integrations/microsoft-dynamics could be tagged as:

https://roipaths.com/integrations/microsoft-dynamics?utm_medium=paidsocial&utm_source=facebook&utm_campaign=brand-campaign

You can choose a different structure, but keeping the same structure across every ad makes later reporting far easier. Free online UTM builders can help you assemble the URLs consistently.

Step 3: Confirm the form captures the campaign data

When a visitor arrives from a Facebook ad, the script reads the UTM parameters and stores them in a cookie. If the visitor browses other pages before converting, the stored values remain available.

On form submission, the script writes the campaign data into the hidden fields alongside the lead's name, email and phone number.

A worked example makes the mapping concrete. Picture a visitor who clicks a Facebook ad, explores a few pages and then requests a demo. The hidden fields are filled from the UTM values on that ad's URL. Suppose the ad's URL named the campaign Brand Campaign, the ad set North America Ad Group and the creative Green Ad. The lead record would then read Paid Social in the Channel field, with Facebook, Brand Campaign, North America Ad Group and Green Ad occupying the four drilldown fields in sequence. Each level of the ad structure therefore lands in its own field rather than being flattened into a single string.

In addition to the channel fields, the script records the landing page (for example, microsoft.com/dynamics/crm) and the landing page group (for example, /dynamics). Those two values let you report on which content attracts converting visitors.

Step 4: Send the data into Microsoft Dynamics CRM and report on it

The final step is delivery. The campaign fields arrive in Dynamics CRM together with the lead's contact details. From there you can build reports with the native Dynamics reporting tools, or connect a BI tool such as Microsoft Power BI for more advanced analysis.

Before trusting any report, run this pre-flight check:

  1. Open a test Facebook ad URL and confirm the UTM parameters appear in the address bar.
  2. Submit a test form and confirm the hidden fields contain values.
  3. Open the resulting lead in Dynamics CRM and confirm the Channel and Drilldown fields are populated.
  4. If step 1 or 2 fails, the problem is tagging or form configuration. If step 3 fails, the problem is the connection between the form and CRM.

Why use a dedicated attribution layer instead of ad-platform reporting alone?

Four practical benefits matter when you compare this setup with simpler alternatives:

  • Full-channel coverage. Leads from referrals, organic social, organic search and direct traffic are classified too, so Facebook Ads can be compared against every other source rather than viewed in isolation.
  • Persistence across the visit. Because the UTM values are stored in a cookie, a form submitted on a later page still carries the original campaign data.
  • Consistent classification. Minor UTM inconsistencies, such as utm_source=facebook in one campaign and utm_source=facebook.com in another, are normalized so those leads still land in the Paid Social channel.
  • Landing-page context. The landing page URL and landing page group are captured alongside the campaign fields, so you can report on content performance as well as campaign performance.

Three reports worth building first

Leads by channel. A breakdown of lead counts by channel shows how Facebook Ads perform relative to other sources. If another channel consistently produces more leads at a lower cost, that is useful evidence for where budget belongs.

Customers by campaign. A monthly count of new customers, split by the Facebook campaign that produced them, shows which campaigns actually convert rather than merely generate clicks.

Revenue by campaign. Monthly revenue attributed to each campaign supports a return-on-investment comparison. The original worked example in this guide's reference material used a figure of $65,000 in new revenue from Facebook Ads in August; if total spend on ads, agencies and creative stayed below that figure, the campaign was profitable. Treat that figure as an illustrative example, not a benchmark for your own account.

A field-to-report map helps when you build these:

  • Channel and Channel Drilldown 1 → leads by channel
  • Channel Drilldown 2 → customers and revenue by campaign
  • Channel Drilldown 3 and 4 → ad set and ad level detail
  • Landing page and landing page group → content performance

Getting started

The setup has four moving parts: the script on your site, the hidden fields on your forms, consistent UTM tagging on every Facebook ad, and a working connection from the form into Dynamics CRM. Once all four are in place, campaign data becomes a normal part of every lead record and can be reported on alongside leads from every other channel.

Start with one campaign and one form. Verify the full path from ad click to CRM record before rolling the setup out to every campaign.

Frequently asked questions

Do I have to use UTM parameters for Facebook Ads tracking to work?

Yes. The attribution script derives campaign, ad set and ad information from the UTM parameters on the ad's destination URL. Without them, the visit can still be classified by channel, but the specific campaign and ad cannot be identified.

What happens if my UTM values are inconsistent between campaigns?

The script is designed to recognize common inconsistencies. For example, utm_source=facebook in one campaign and utm_source=facebook.com in another are both assigned to the Paid Social channel, so the leads still appear under the correct channel in reporting.

What if a visitor leaves the landing page before submitting a form?

The UTM values are stored in a cookie in the visitor's browser, so the original campaign data is still written into the hidden fields when the form is submitted on a later page.

Can I report on this data without a separate BI tool?

Yes. Microsoft Dynamics CRM's native reporting tools can build reports from the captured fields. A BI tool such as Microsoft Power BI is optional and is useful when you want more advanced analysis.

Is there a free trial?

Before choosing a plan, confirm the current pricing, included usage, trial conditions, billing schedule and cancellation terms.