Click ID & Referrer Capture for Contact Form 7
If you run Google Ads or Microsoft Advertising for a business that generates enquiries rather than online sales, the click that produced the enquiry is the piece of data you need, and it is the piece that is usually lost. The visitor arrives with a gclid in the address bar, browses for a while, fills in your Contact Form 7 form two days later, and by then the click identifier has gone.
This plugin keeps it. On every page view it reads the advertising parameters from the query string, stores a first touch and a last touch record in a first-party cookie on your own domain, and writes those values into hidden fields on every Contact Form 7 form. When the form is sent, the values arrive in your notification email, in Flamingo, and in an optional submission log that you can export as a CSV file ready for the Google Ads or Microsoft Advertising offline conversion importer.
What it captures
- Google Ads:
gclid,gbraid,wbraidanddclid - Microsoft Advertising:
msclkid - Meta, TikTok and LinkedIn:
fbclid,ttclid,li_fat_id - Campaign parameters:
utm_source,utm_medium,utm_campaign,utm_term,utm_content,utm_id - The first referrer, the first landing page including its query string, the first seen time and the last seen time
First touch values are written once and never overwritten. Last touch values are refreshed whenever a new value appears, so you can see both the campaign that introduced the visitor and the campaign that brought them back.
Why offline conversions need the click ID
Google Ads Smart Bidding learns from conversions. For a lead generation business the conversion that matters is the enquiry that turned into a customer, not the form submission itself. To report that back to Google you need the gclid of the click that produced the lead, the conversion name, the conversion time and, ideally, a value. That is exactly what the CSV export produces. Since 2022, clicks from iOS App campaigns and some Performance Max placements arrive with gbraid or wbraid instead of gclid, so the plugin captures and exports all three. Without the identifier there is nothing to match, and the bidder learns from form fills instead of customers. That is the gap the CRM feedback loop closes.
The CSV exports
The Submissions tab lists every logged form, with a date and form filter, and three export buttons.
- Google Ads offline conversions. The header row Google expects, a
Parameters:TimeZone=first line set from your site's time zone, and aGoogle Click ID,GBRAIDandWBRAIDcolumn with one of the three filled per row, plus conversion name, time, value and currency. Upload under Goals, Conversions, Uploads. - Microsoft Advertising offline conversions. The
Microsoft Click IDcolumn and the same conversion fields. Upload under Tools, Conversion tracking, Offline conversions. - Full log. Every column, for your own reporting.
The default conversion name, value and currency are settings, with per-form overrides, so a quote form and a booking form can carry different names and values.
Consent mode
Consent Mode v2 governs what Google's tags do. This plugin governs a first-party cookie of its own, so it has its own Wait for consent storage mode. In that mode the values are held in the browser session only, and the cookie is written after your consent banner reports that advertising storage has been allowed. The settings page takes the consent cookie name and the text that indicates advertising consent, and lists the cookie names used by CookieYes, Cookiebot and Complianz. Your banner can also call window.cidrc.consentGranted() or dispatch a cidrc:consent event on the document.
Webhook to n8n
Put an n8n, Make, Zapier or custom webhook URL in the settings and every sent form is posted as JSON. An optional secret is sent as the X-CIDRC-Secret header so the workflow can reject anything else. The payload carries the click identifiers, the campaign parameters, the landing page, the referrer, the form ID and title, the hashed email and the conversion name, value and currency. The raw email address is left out unless you explicitly switch it on. From there the workflow writes to the CRM, and when the stage you care about is reached, sends the outcome back to Google Ads Data Manager.
Data protection
Nothing is sent anywhere by default. There is no external service, no account, no API key and no phone-home. The submission log never stores a raw email address or telephone number; it stores a SHA-256 hash, which is what Google and Microsoft accept for enhanced conversions anyway. Log retention is a setting in days, and a daily scheduled task deletes anything older. Uninstalling the plugin drops the table and deletes the options.
Install
- In your WordPress admin, go to Plugins, Add New, search for "Click ID & Referrer Capture", and install it. You can also upload the ZIP file under Plugins, Add New, Upload Plugin.
- Activate the plugin.
- Go to Settings, Click ID Capture, and check the settings. The defaults are sensible: always store, a 90 day cookie, a submission log with 90 day retention.
- Set the default conversion name to match the conversion action you created in Google Ads or Microsoft Advertising exactly, and set a currency.
- Visit any page of your site with
?gclid=test123on the end, then open a page that contains a Contact Form 7 form and send a test message. The attribution block should appear in the notification email.
Contact Form 7 is not required for the capture itself. With Contact Form 7 inactive the cookie is still written, and cidrc_get_values() and the [cidrc_debug] shortcode still work.
WordPress.org listing: Click ID & Referrer Capture for Contact Form 7 (placeholder link until the plugin review is complete). The source is on GitHub under GPL-2.0-or-later. The whole plugin is free. There is no paid tier, no upsell screen and no feature that asks for a subscription.
Check it worked
The free Click ID Checker Chrome extension reads the page and reports whether the click ID survived, whether consent allowed the cookie and whether the hidden fields are populated. If the report says attributable, the plugin is doing its job.
FAQ
How do I pass gclid to my CRM?
Three ways, and you can use all three at once. The plugin adds a hidden field called cidrc_gclid to every Contact Form 7 form, so anything that reads posted form data, including Flamingo and most CRM connectors, picks it up with no extra configuration. The [cidrc_summary] mail tag puts a readable block into the notification email. And a webhook URL in the settings posts every sent form as JSON to your endpoint, which is the neatest route into n8n, Make, Zapier or a custom CRM API.
Does this work with Consent Mode v2?
It works alongside it. Consent Mode v2 governs what Google tags do. This plugin governs a first-party cookie of its own, so set Storage mode to Wait for consent and give it your consent banner's cookie name and the text that indicates advertising consent. Until that is present, values stay in the browser session and no cookie is written. The settings page lists the cookie names used by CookieYes, Cookiebot and Complianz. You can also call window.cidrc.consentGranted() from your banner's own callback.
Where is the data stored?
In two places, both of which belong to you. A first-party cookie named cidrc on your own domain, with a localStorage copy as a fallback, holds the visitor's values. If the submission log is switched on, one row per sent form is written to a table in your own database, with hashed contact details rather than raw ones. No data leaves your site unless you configure a webhook yourself.
How do I upload the CSV to Google Ads?
In Google Ads, go to Goals, Conversions, Uploads, then upload the file from the Submissions tab of the plugin. The file already contains the header row Google expects and a first line reading Parameters:TimeZone=Europe/London, or whichever time zone your site uses. The conversion name in the file has to match the name of an import-enabled conversion action in your account exactly. Microsoft Advertising exports work the same way through Tools, Conversion tracking, Offline conversions.
Does it capture gbraid and wbraid?
Yes, both, and dclid as well. Clicks from iOS App campaigns and some Performance Max placements carry gbraid or wbraid instead of gclid, and the Google Ads CSV export includes a column for each of the three so that the importer can match whichever one is present.
Is it GDPR compliant?
The plugin gives you the tools to be compliant, and the rest depends on how you configure it. Click identifiers stored against a visitor are personal data in the UK and EU, so you need a lawful basis, normally consent, and you need to mention the cidrc cookie in your cookie notice. Use the wait for consent storage mode with your consent banner. The submission log stores hashes rather than raw contact details, retention is capped by a setting, and uninstalling removes everything. The plugin sends nothing to any third party on its own.