Capture Facebook Ads Data in Ninja Forms
A form submission can record more than a name and email. When Facebook ad URLs carry consistent UTM parameters and an attribution script is present on the site, the campaign, ad set and ad behind a lead can travel with that submission into Ninja Forms. The result is a lead record that shows its paid-social origin instead of arriving as an anonymous enquiry.
Start with UTM parameters on every ad
UTM parameters are additional query text appended to a destination URL. They are the carrier for the attribution detail: without them, the landing page alone cannot reliably identify which campaign, ad set or ad produced the visit. A practical mapping for Facebook ads is to use a paid-social medium, Facebook as the source, the campaign name for campaign, the ad set name for term, and the specific ad for content. Consistency matters more than inventing elaborate values — the same naming should be reused so reports group correctly. Free UTM builders can assemble the final URL, but the key decision is the naming convention you will keep across active ads.
Install the attribution code and let it persist the visit
An attribution script installed on the website examines how a visitor arrived, identifies the origin, and retains the UTM values in a browser cookie. That persistence is the distinction from simply reading parameters on the landing page: a visitor may browse several pages before completing a form, and the cookie keeps the original ad data available at submission. When the form is submitted, the script populates the hidden fields, so the values are stored alongside the visible lead details. In practical terms, install the code site-wide first, then verify that a test visit from a tagged URL still carries its values through to a later form.
Add the seven hidden fields to the form
The form needs seven hidden fields: Channel, Channel Drilldown 1, Channel Drilldown 2, Channel Drilldown 3, Channel Drilldown 4, Landing Page and Landing Page Group. In Ninja Forms these are added by dragging a Hidden field type into the form. Use them on the forms that capture leads, such as a contact or quote-request form. A useful check is to submit a test form after arriving from a tagged ad and confirm that every hidden field is populated in the stored submission, not just the visible fields.
Use the data where decisions happen
Once captured, the data can be routed in several ways. Passing it to a CRM supports reports on leads, customers and revenue by campaign. Sending it to a spreadsheet enables basic analysis or feeds dashboard tools. Including it in email notifications lets a responder see the origin of each lead without opening another system. Sending it to a billing platform supports revenue reporting by ad source. The choice depends on where decisions are already made: CRM for pipeline, spreadsheet for analysis, email for immediate response, billing for revenue.
What else the setup reveals
Beyond Facebook ads, the same setup can identify other origins such as organic social, paid search, organic search, direct and referral traffic, giving a complete picture of lead sources. It also normalises inconsistent UTM usage — for example, variations in how Facebook is spelled in a source value can still be assigned to the correct channel — and it records the landing page URL and its group, such as a blog section, so content performance can be examined alongside campaign performance.
Three reports to build first
Three reports illustrate the value. Leads by channel compares Facebook performance with other channels to inform budget allocation. Leads by network separates results across Facebook, Instagram, Messenger and other placements to show which app produces leads. Leads by campaign separates campaigns that generate leads from those that generate only clicks and non-converting visits, which helps refine targeting and creative. Build these only after the hidden fields are populated consistently; otherwise the reports will understate performance.
| UTM parameter | Suggested value for Facebook ads |
|---|---|
| UTM Medium | Paid social |
| UTM Source | |
| UTM Campaign | Name of the campaign |
| UTM Term | Name of the ad set |
| UTM Content | Specific ad |
Naming convention from source; keep values consistent across ads.
| Hidden field | Purpose in the submission |
|---|---|
| Channel | Broad origin channel |
| Channel Drilldown 1 | First level of channel detail |
| Channel Drilldown 2 | Second level of channel detail |
| Channel Drilldown 3 | Third level of channel detail |
| Channel Drilldown 4 | Fourth level of channel detail |
| Landing Page | URL where the visitor first landed |
| Landing Page Group | Group of the landing page, such as a blog section |
Fields are populated by the attribution code at submission.
| Destination | What it enables |
|---|---|
| CRM | Lead, customer and revenue reporting by campaign |
| Spreadsheet | Basic analysis or dashboard reporting |
| Email notification | Origin visible with each lead notification |
| Billing platform | Revenue reporting by ad source |
Routing options described in source; integrations vary by platform.
Frequently asked questions
What are the four setup steps?
Add UTM parameters to the ad destination URL, install the attribution code on the site, add the seven hidden fields to the form, and let the code write the stored values into those fields at submission.
Which hidden fields are needed?
Channel, Channel Drilldown 1, Channel Drilldown 2, Channel Drilldown 3, Channel Drilldown 4, Landing Page, and Landing Page Group.
Why store the data in a cookie?
Storing the parameters in a browser cookie preserves them while the visitor moves between pages, so the form does not need to be on the first landing page.
Where can the captured data be used?
Send the captured values to a CRM for lead-to-customer and revenue reporting, to a spreadsheet for analysis or dashboard tools, into email notifications, or to a billing platform for revenue reporting.