WPForms logo

WPForms

WPForms UTM tracking and lead source capture

WPForms records what people type. The channel, campaign and keyword that brought them sit in the URL and the referrer, and nothing in WPForms reads either. Add hidden fields and SourceTag fills them in before the form posts.

Your website

Script installed

SourceTag

Captures attribution

WPForms

Hidden fields sent

Your tools

Data arrives tagged

The problem

WPForms captures what people type into the form. It has no idea how that visitor found your site, or which ad they clicked to get there. That data lives in the URL and the referrer, not in anything WPForms can see on its own.

How to set it up

Add a handful of hidden fields to your WPForms form. SourceTag's script finds them and fills them in the moment someone hits submit, so the channel, click ID and landing page arrive with the rest of the entry.

1

Get SourceTag running

Install the SourceTag plugin and drop in your Site ID.

2

Name the hidden fields to match

In WPForms, add hidden fields called st_fc_channel, st_fc_detail_1 and so on. Your SourceTag dashboard has the full list.

3

Submit one test entry

Load your site with ?utm_source=test&utm_medium=cpc, submit the form, and look for the attribution data on the entry.

The twelve fields to add

st_fc_channel, st_fc_detail_1 through st_fc_detail_4 and st_fc_landing_page cover the first click. The same six with st_lc_ cover the last click. Those twelve are always populated, so add all of them even if you only report on two.

Detail fields carry different data per channel. Paid Search fills them with utm_source, utm_campaign, utm_term and utm_content. Organic Search puts the search engine in detail 1 and the referrer URL in detail 2. Direct leaves all four as (not set).

st_fc_landing_page keeps the path and query string of the page they arrived on, with the UTM parameters and click IDs stripped out. So /services?ref=nav keeps the ref and drops the utm_source, which makes it readable in a report rather than a wall of query string.

If you have turned on extra field groups in your dashboard, add st_fc_click_id, st_lc_click_id, st_visits, st_days_to_convert and st_device as well. Every field name is listed here.

Adding hidden fields in the WPForms builder

The Hidden Field type lives under Fancy Fields in WPForms Pro. Drag one in, click it, and put the SourceTag field name in the Label box. Leave Default Value empty, because SourceTag writes the value at submit time.

1

Open WPForms > All Forms and edit your form

Any form on the site works. The script fills whatever hidden fields it finds on the page.

2

Drag in one Hidden Field per SourceTag field

Set the Label to the exact field name, for example st_fc_channel. Repeat for the other eleven core fields.

3

Check the Advanced tab

WPForms uses a numeric field ID internally, but the label is what gets passed to email notifications, Zapier and CRM integrations. That label has to match the SourceTag name.

4

Save, then submit a test entry

WPForms > Entries shows the stored values next to the visible fields.

WPForms Lite does not have hidden fields

Lite has no Hidden Field type. Use the HTML field instead and paste a raw input for each one. It behaves identically as far as SourceTag is concerned, because the script matches on the name attribute.

<input type="hidden" name="st_fc_channel">
<input type="hidden" name="st_fc_detail_1">
<input type="hidden" name="st_fc_detail_2">
<input type="hidden" name="st_fc_detail_3">
<input type="hidden" name="st_fc_detail_4">
<input type="hidden" name="st_lc_channel">
<input type="hidden" name="st_lc_detail_1">
<input type="hidden" name="st_lc_detail_2">
<input type="hidden" name="st_lc_detail_3">
<input type="hidden" name="st_lc_detail_4">
<input type="hidden" name="st_fc_landing_page">
<input type="hidden" name="st_lc_landing_page">

Getting the script onto the page first

On WordPress, install the SourceTag plugin, paste your Script URL under Settings > SourceTag, and save. The plugin loads st.js on every page and can also set the attribution cookie from PHP, which is what keeps Safari from dropping it after seven days.

If you would rather not add a plugin, paste the script tag into your theme header. You lose the server-side cookie option, so first click data on Safari and iOS survives a week rather than 400 days.

Test with a UTM link

Load a page that has the form on it, using a URL like this one.

Before you submit, open dev tools and look at the form element. The hidden inputs should already hold values: st_fc_channel reads Paid Search because utm_medium is cpc, st_fc_detail_1 reads google, st_fc_detail_2 reads spring-promo. Submit, then check WPForms > Entries.

Empty values arrive as (not set), not blank. That is deliberate: it tells you the field was captured and had nothing in it, rather than the field never being filled at all.

https://yoursite.com/contact?utm_source=google&utm_medium=cpc
  &utm_campaign=spring-promo&utm_term=emergency+plumber

Common mistakes

Setting a Default Value on the hidden field. WPForms will submit that default and it looks like SourceTag overwrote nothing. Leave it empty.

Changing the label after connecting the form to a CRM. The connection maps on the label, so renaming the field breaks the mapping silently.

Forms inside a popup or a multi-step layout are fine. The script watches the page for forms that appear later, so a modal that opens after five seconds still gets filled. Forms loaded in a cross-domain iframe are not, because the script cannot reach inside one.

Tracking only the contact form. The script fills every form on the site, so add the hidden fields to your quote request and newsletter forms too. A channel comparison built on one form is really a comparison of that form.

Where your data ends up

WPForms sends form data to your CRM, email tool, or wherever you've connected it. The attribution data rides along in the hidden fields.

Frequently asked questions

Related integrations

Start with one form.

The trial is 14 days and doesn't need a card.