Skip to content

Track Facebook Ads in Gravity Forms: A Field-by-Field Setup Guide

If you run Facebook Ads and collect leads through Gravity Forms, the form entry alone rarely tells you which campaign produced the lead. This guide shows how to attach UTM parameters to your ads, install a small attribution script, add the right hidden fields, and confirm that the campaign, ad set and ad data arrive with each submission. It also explains how to turn that data into reports that compare channels, ad networks and campaigns.

What you need before you start

You need three things in place: Facebook Ads that point to landing pages on your site, a Gravity Forms form that collects lead details, and a way to read UTM parameters and write them into hidden fields. The attribution tool used here is Attribution Analytics, a small piece of code added to your website. When a visitor arrives, it inspects the same kind of technical signals that analytics tools use and determines where the visit originated. On form submission, it writes that information into hidden fields alongside the visitor's name, email and other answers. The setup is complete when a test submission shows the expected campaign values in the entry.

Step 1: Add UTM parameters to your Facebook Ads

UTM parameters are short text tags appended to the destination URL. They tell your form where the click came from. A typical Facebook Ads URL might look like this: https://roipaths.com/integrations/gravity-forms?utm_medium=paidsocial&utm_source=facebook&utm_campaign=brand-campaign. The exact structure is up to you, but a consistent convention makes reporting far easier. A common pattern 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. Free URL-building tools can help you assemble these tags without typos.

Step 2: Install the attribution script on your website

The script is added once to your site. On each visit it evaluates how the visitor arrived and stores the relevant UTM values in a cookie in the visitor's browser. That cookie is what allows the data to survive as the visitor moves between pages before completing a form. {{OWNER_INSTALL_INSTRUCTIONS}} The script does not replace Gravity Forms — it supplies the values that Gravity Forms will capture. {{OWNER_TRIAL_DURATION}} {{OWNER_FREE_START}}

Step 3: Add hidden fields to your Gravity Forms

In Gravity Forms, drag a Hidden field type into the form for each value you want to capture. The fields used in this setup are: Channel; Channel Drilldown 1; Channel Drilldown 2; Channel Drilldown 3; Channel Drilldown 4; Landing Page; Landing Page Group. Add them to every lead-capture form where you want attribution data — for example a contact form or a quote request form. The field labels must match the names the script writes to, otherwise the values will not land in the entry.

Step 4: Confirm the data is captured on submission

When a visitor arrives from a Facebook Ad, the script reads the UTM parameters and stores them in the browser cookie. When that visitor later submits a form — even on a different page — the script writes the stored values into the hidden fields. Gravity Forms then saves them with the lead's name, email and other answers. To verify the setup, submit a test form using a URL that carries your UTM tags and check that the entry shows the expected campaign, ad set and ad values.

Field and control map

Use this map to check that each hidden field is present and that you know what it should contain.

Where the captured data can go

Once the values are stored in Gravity Forms, you can route them onward using Gravity Forms' native integrations or a connector such as Zapier. Common destinations include: a CRM such as Salesforce, HubSpot or Pipedrive, where you can report on lead counts, conversions and revenue; a spreadsheet such as Google Sheets or Excel, which can feed reporting tools like Google Data Studio or Microsoft Power BI; lead notification emails, so the source appears in the message you already receive; and a billing platform such as Stripe, Square or PayPal, where the data can support revenue reporting.

Reading the field map: what each captured value answers

Each hidden field answers a different question, so read the map as a set of lenses rather than a single source label. Channel tells you which route brought the lead — Paid Social for a Facebook Ad, but also Organic Search, Organic Social, Referral or Direct for visitors who never clicked an ad, which is what lets one report rank paid social against every other route instead of judging it alone. The Channel Drilldown fields narrow that route to the network, campaign, ad set and ad, so a Paid Social lead can be traced to the exact placement. Landing Page and Landing Page Group (for example /blog) show which content pages start converting journeys. Two behaviours keep those lenses trustworthy: the UTM values sit in a browser cookie, so a lead who lands on one page and converts several pages later still carries the original campaign data; and common tagging slips such as utm_source=facebook versus utm_source=facebook.com are folded into the same channel rather than split into two rows.

Three reports worth building

If the captured data is sent to a CRM or spreadsheet, you can build reports that answer specific questions. Leads by channel shows how Facebook Ads compare with other channels and supports budget decisions. Leads by network separates Facebook, Instagram, Messenger and other placements so you can see which app produces the most leads. Leads by campaign shows monthly lead volume per campaign, helping you distinguish campaigns that generate clicks from campaigns that generate conversions.

Troubleshooting checklist

If a submission arrives without campaign data, work through these checks in order. First, confirm the ad's destination URL actually contains the UTM parameters. Second, confirm the hidden field labels in Gravity Forms match the names the script writes to. Third, confirm the script is installed on every page the visitor might use before submitting. Fourth, confirm the visitor's browser accepts cookies. Fifth, submit a fresh test using a tagged URL and inspect the entry. Separating a missing UTM from a missing hidden field from a blocked cookie will usually identify the cause quickly.

Hidden field reference
FieldWhat it should contain
ChannelThe marketing channel, such as Paid Social
Channel Drilldown 1First level of detail, such as the network
Channel Drilldown 2Second level, such as the campaign
Channel Drilldown 3Third level, such as the ad set
Channel Drilldown 4Fourth level, such as the specific ad
Landing PageThe URL of the page the visitor first landed on
Landing Page GroupA grouped label for that page, such as /blog

Field names are exact; the example contents illustrate the intended mapping and depend on your UTM convention.

Frequently asked questions

Do I need to add UTM parameters to every Facebook Ad?

Yes, if you want campaign-level reporting. The script reads the UTM values from the URL, so an ad without tags will not carry campaign, ad set or ad information into the form. A consistent convention across all ads keeps the reports comparable.

What happens if a visitor submits a form on a different page from the one they landed on?

The UTM values are stored in a cookie in the visitor's browser, so they are available when the form is submitted later on another page. That is why the source data can still appear in the entry even after several page views.

Can I capture leads from channels other than Facebook Ads?

Yes. The same setup records organic search, organic social, referral and direct visits, so you can compare Facebook Ads with every other channel in the same reports.

What if my UTM source values are inconsistent?

The script is designed to handle common inconsistencies, such as utm_source=facebook in some campaigns and utm_source=facebook.com in others, and still assign those leads to the correct channel.