How to Track Facebook Ads in HubSpot CRM
If you run Facebook ads and manage leads in HubSpot, the gap between ad spend and closed revenue is usually a data gap, not a reporting gap. HubSpot can manage a lead from first touch through to a closed-won deal, but it can only report on the source of that lead if the source is written into the record. This guide shows how to capture Facebook ad attribution in HubSpot using UTM parameters and hidden form fields, then turn that data into campaign-level reports.
Why Facebook ad data needs to reach the CRM
HubSpot is built to move leads and deals through a pipeline. What it cannot do on its own is know that a particular lead clicked a Facebook ad, which campaign that ad belonged to, or which ad set and creative were involved. Without that information in the CRM, you can see that leads exist but not which ads produced them.
Capturing the source at form submission closes that gap. Once the data is stored on the contact or deal record, you can compare Facebook ads with organic search, Google Ads, referrals and direct traffic, and you can follow the same cohort through to closed-won revenue. The goal is not just to count leads but to see which campaigns produce customers and which produce cost without return.
How the attribution layer works
A short tracking script on your site does the classification work. On each visit, it examines the referrer, URL parameters and other request details that analytics platforms also rely on, then assigns the visit to a standard channel such as Organic Search, Paid Social or Paid Search. The assigned channel is written to a cookie in the visitor's browser so it can be read again later.
When the visitor submits a form, the script writes the attribution data into hidden fields you have added to the form. That data travels with the lead's name, email and other details into HubSpot CRM, and from there into any connected email, billing or analytics tool. Because the data is stored in a cookie, it survives the visitor browsing other pages before converting, so a form filled in on a later page still carries the original source.
Four setup steps
The setup has four parts: install the script, tag your Facebook ads with UTM parameters, let the script populate hidden fields, and confirm the data arrives in HubSpot. Each part has a distinct failure mode, so it helps to treat them as separate checks rather than one big switch.
Step 1: Install the script and add hidden fields
After signing up, you receive a snippet of code to place on your site. You can usually add it through your site's settings section, or you can deploy it with a tag manager such as Google Tag Manager. Installation guidance for common setups is available in the help center.
Next, add hidden fields to every lead capture form. The field set is: Channel, Channel Drilldown 1, Channel Drilldown 2, Channel Drilldown 3 and Channel Drilldown 4. Most form builders let you drag a hidden field type into the form or convert a standard field to hidden in its settings. The important point is that the field names match exactly, because the script writes to those names.
Step 2: Add UTM parameters to Facebook ads
UTM parameters are extra text appended to the destination URL. They tell the attribution layer which campaign, ad set and ad produced the click. A typical Facebook ad URL might look like this: https://roipaths.com/integrations/hubspot?utm_medium=paidsocial&utm_source=facebook&utm_campaign=brand-campaign.
You can choose your own structure, but a consistent pattern makes reporting easier. A practical convention is: UTM Medium = Paid social; UTM Source = Facebook; UTM Campaign = the campaign name; UTM Term = the ad set name; UTM Content = the specific ad. Facebook provides its own guide to adding URL parameters, and free URL builder tools can help you assemble them consistently.
Step 3: Confirm the hidden fields are populated
When a visitor arrives from a Facebook ad, the script captures the UTM parameters and keeps them in a cookie. When the visitor submits a form, the script writes the values into the hidden fields.
A worked example makes the mapping concrete. Suppose a marketer runs a Facebook ad for a CRM demo with these parameters: utm_medium=paidsocial, utm_source=facebook, utm_campaign=brand-campaign, utm_term=north-america-ad-group and utm_content=green-ad. The hidden fields would receive: Channel = Paid Social; Channel Drilldown 1 = Facebook; Channel Drilldown 2 = Brand Campaign; Channel Drilldown 3 = North America Ad Group; Channel Drilldown 4 = Green Ad.
The script also captures the landing page URL and the landing page group. For example, a visitor who lands on hubspot.com/features/contact-management would produce a landing page value of that URL and a landing page group of /features. This lets you report on which content pages attract converting traffic.
Step 4: Verify the data in HubSpot
All of the attribution data is passed into HubSpot CRM alongside the lead's name, email and phone. Once it is there, you can build reports with HubSpot's built-in reporting tools, or export the data to a BI tool such as Tableau or Google Data Studio for more advanced analysis.
Before building reports, submit a test form from a tagged ad URL and confirm that each hidden field appears on the resulting contact record. If the fields are blank, check the field names, the script installation and whether the UTM parameters are present on the landing URL.
Field and control map
The table below shows how each UTM parameter maps to a hidden field and what the resulting value looks like in the worked example. Use it as a checklist when configuring forms and ad URLs.
What this setup adds beyond Facebook-only tracking
Capturing Facebook ad data is useful, but the same mechanism can classify every lead. Organic Search, Organic Social, Referral and Direct traffic can all be recorded in the same Channel and Channel Drilldown fields. That makes it possible to compare Facebook ads with other channels on a like-for-like basis.
Two design choices matter for accuracy. First, storing the UTM parameters in a cookie means the source is retained even if the visitor converts on a different page. Second, the classification logic recognises common inconsistencies, such as utm_source=facebook in one campaign and utm_source=facebook.com in another, and still places the lead in the correct channel. That reduces manual cleanup and makes the data more reliable for budget decisions.
Three reports to run
Once the data is flowing, three reports give a useful view of Facebook ad performance. The first is leads by channel, which shows how many leads each channel produced and supports budget comparisons. The second is customers by campaign, which shows which campaigns generate the most new customers over time. The third is revenue by campaign, which shows the revenue attributed to each campaign and supports return-on-ad-spend decisions.
The revenue report is the clearest test of whether a campaign is worth continuing. If the revenue attributed to a campaign exceeds its ad spend, the campaign is contributing positive return. If it does not, the campaign may need to be paused or reworked. Breaking the same report down by campaign and ad group shows where to invest more and where to stop.
Troubleshooting: three distinct failure modes
Blank attribution data usually comes from one of three places, and each has a different fix. If the hidden fields are missing from the form, the script has nowhere to write, so add the five fields with exact names. If the UTM parameters are missing from the ad URL, the script has no campaign data to classify, so check the final URL in the ad. If the cookie is being lost, the visitor may be converting in a context where the cookie is unavailable, such as a different browser or a blocked cookie setting, so review consent and cookie behaviour.
A quick diagnostic is to submit a test form from a tagged URL and inspect the contact record. If Channel is populated but the drilldowns are blank, the issue is in the UTM structure rather than the form. If all fields are blank, start with the form and script.
Getting started
Tracking Facebook ads in HubSpot comes down to three things: a script that classifies the visitor, UTM parameters that identify the campaign, and hidden fields that carry the data into the CRM. Once those are in place, you can report on leads, customers and revenue by channel and campaign, and compare Facebook ads with every other source.
Start with one campaign and one form. Confirm the data appears correctly, then roll the same pattern out to the rest of your ads and forms.
| UTM parameter | Hidden field | Example value |
|---|---|---|
| utm_medium | Channel | Paid Social |
| utm_source | Channel Drilldown 1 | |
| utm_campaign | Channel Drilldown 2 | Brand Campaign |
| utm_term | Channel Drilldown 3 | North America Ad Group |
| utm_content | Channel Drilldown 4 | Green Ad |
Example values are illustrative and depend on the UTM structure you choose.
Frequently asked questions
Do I need UTM parameters if I already use the Facebook pixel?
The pixel and UTM parameters serve different purposes. The pixel supports ad-platform measurement and optimisation. UTM parameters identify the campaign, ad set and ad in the URL so the attribution layer can write those values into HubSpot. For CRM-level reporting on leads, deals and revenue, the UTM parameters are the part that connects the click to the contact record.
What happens if a visitor converts on a different page from the ad landing page?
The UTM parameters are stored in a cookie in the visitor's browser, so they are retained as the visitor moves through the site. When the form is submitted on a later page, the stored values are written into the hidden fields. This is why the cookie-based approach produces more complete data than reading parameters only on the landing page.
Can I track channels other than Facebook ads with the same setup?
Yes. The same Channel and Channel Drilldown fields can classify Organic Search, Organic Social, Referral and Direct traffic. That lets you compare Facebook ads with other channels in the same reports rather than treating Facebook as a separate system.
How do I know whether a campaign is worth continuing?
Compare the revenue attributed to the campaign with its ad spend. If attributed revenue exceeds spend, the campaign is contributing positive return and is a candidate for continued or increased investment. If it does not, review the campaign and ad group breakdown to decide whether to pause, rework or reallocate budget.