Contact Form 7
Contact Form 7 lead source tracking
Contact Form 7 posts exactly the fields you declare in the form editor. Declare a few hidden ones with the SourceTag names and every enquiry arrives with the channel, campaign, keyword and landing page attached.
Your website
Script installed
SourceTag
Captures attribution
Contact Form 7
Hidden fields sent
Your tools
Data arrives tagged
Your website
Script installed
SourceTag
Captures attribution
Contact Form 7
Hidden fields sent
Your tools
Data arrives tagged
The problem
Contact Form 7 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 Contact Form 7 can see on its own.
How to set it up
Add a handful of hidden fields to your Contact Form 7 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.
Get SourceTag running
Install the SourceTag plugin and drop in your Site ID.
Name the hidden fields to match
In Contact Form 7, add hidden fields called st_fc_channel, st_fc_detail_1 and so on. Your SourceTag dashboard has the full list.
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 hidden field shortcodes
CF7 has a [hidden] shortcode. Paste these anywhere in the form template. Visitors see nothing, and the layout does not move.
[hidden st_fc_channel]
[hidden st_fc_detail_1]
[hidden st_fc_detail_2]
[hidden st_fc_detail_3]
[hidden st_fc_detail_4]
[hidden st_lc_channel]
[hidden st_lc_detail_1]
[hidden st_lc_detail_2]
[hidden st_lc_detail_3]
[hidden st_lc_detail_4]
[hidden st_fc_landing_page]
[hidden st_lc_landing_page]Add the fields to your email template too
CF7 does not store submissions by default, so if you stop after step one the data is captured and then thrown away. Open the Mail tab and add the field tags to the message body.
Install Flamingo if you want them stored in WordPress as well. Hidden field values appear in Flamingo messages next to the name and email, so anyone can search past enquiries by campaign without opening a CRM.
First click: [st_fc_channel] / [st_fc_detail_1] / [st_fc_detail_2]
Keyword: [st_fc_detail_3]
Last click: [st_lc_channel] / [st_lc_detail_1]
Landing page: [st_fc_landing_page]What the values look like in a real enquiry
Someone searches emergency electrician, clicks your ad, reads the page and fills in the form. The email arrives with First click: Paid Search / google / local-services, Keyword: emergency electrician, Landing page: /emergency-electrician.
The same person coming back a week later through an organic search gets a different last click. First click stays Paid Search forever, because it is written once and never overwritten. Last click updates on every visit that carries new attribution: a UTM, a click ID, or an external referrer.
Fields with no value show (not set). A Direct visit produces st_fc_channel: Direct and (not set) in all four detail fields, which is a real answer rather than a gap.
Install the script on the WordPress side
The WordPress plugin is the shortest route. Upload the zip under Plugins > Add New > Upload Plugin, activate, then paste your Script URL into Settings > SourceTag. It looks like https://cdn.sourcetag.io/scripts/YOUR_SITE_ID/st.js.
While you are in there, tick Enable server-side cookie setting. It re-sets the attribution cookie from PHP on every page load, which is what lets Safari keep it for 400 days instead of seven. If you run WP Rocket, W3 Total Cache or LiteSpeed Cache, exclude the pages with forms from full-page caching so the PHP hook actually runs.
Test with a UTM link
Load the page with the form using a tagged URL, submit it, and read the notification email.
If the email shows the tag names rather than values, the field names in the Mail tab do not match the ones in the form template. If the values are blank rather than (not set), the script did not run: view the page source and search for st.js, and clear your cache if it is missing.
The testing guide covers checking the _sourcetag cookie in dev tools, which is the fastest way to tell a script problem apart from a form problem.
https://yoursite.com/contact?utm_source=google&utm_medium=cpc
&utm_campaign=local-services&utm_term=emergency+electricianWhere CF7 enquiries go next
CF7 has no CRM connection of its own, so firms add one with a third-party plugin, a webhook, or Zapier. All of them map fields by name, which means adding the st_ fields to that mapping at the same time you add them to the form.
A field that exists on the form and in the CRM but is unmapped in the middle arrives empty. It looks exactly like a capture failure and it is not, so check the mapping screen before you touch anything on the website.
If you only email enquiries today, Flamingo plus a monthly export is enough to compare channels. You do not need a CRM to start reading this data.
Common mistakes
Typing [hidden st-fc-channel] with dashes. The names use underscores throughout. Copy them from the Fields page in your dashboard.
Adding the shortcodes but not the Mail tab tags. The data is submitted and then discarded, and it looks like nothing was captured.
Aggressive HTML minification that strips input names is rare but real. If the fields are in the editor and gone in the page source, check your optimisation plugin.
Where your data ends up
Contact Form 7 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
Add [hidden st_fc_channel] and the other eleven core field shortcodes to the form, add the matching tags to the Mail tab, and install the SourceTag script or WordPress plugin. Every enquiry email then carries the channel, campaign and keyword.
The hidden fields do it. utm_source, utm_campaign, utm_term and utm_content land in st_fc_detail_1 through st_fc_detail_4 on paid channels, and the raw UTM values are available as their own field group if you prefer them unmapped.
Not on its own. CF7 emails submissions rather than storing them. Add the tags to the Mail tab, and install Flamingo if you also want the values stored in WordPress.
Yes. Hidden fields are ordinary form inputs that CF7 posts with everything else. They do not affect validation, reCAPTCHA or Akismet.
The script goes on the site once. The shortcodes go in each form you want tracked, because CF7 templates are independent of each other.


