Lead attribution · WordPress
WordPress form attribution: one plugin, five form builders, no code
WordPress form attribution in Skald is one small plugin: activate it, and each form sent becomes a lead, signed, sent in the background, and joined to the visit it came from.
WordPress form attribution is tying each form sent on a WordPress site to where the visitor came from. Skald's plugin listens to five form builders' own "form sent" hooks, the points where WordPress lets other code join in, sends each entry to Skald as a contact lead with the visitor ID, and never slows or breaks the form.
30-day free trial · no card · we set it up within one working day · free to self-host
- Contact Form 7
wpcf7_mail_sent - WPForms
wpforms_process_complete - Gravity Forms
gform_after_submission - Elementor Pro
elementor_pro/forms/new_record - Ninja Forms
ninja_forms_after_submission
skald_leads_send()signed · in the backgroundPOST …/lead · X-Skald-Signature · blocking: false · timeout 3 s
{"external_ref": "wpforms-412",
"action": "contact",
"email": "ada@example.com",
"vid": "skv_Q2xh…"}
kept Contact forms · completed
Sample lead. Five form builders, each heard on its own "form sent" hook, all sent by one function. WPForms, Gravity and Ninja (when it saves submissions) give their own entry id; Contact Form 7 and Elementor get a random one.
[01] email and name
Which WordPress form fields become the lead's email and name? The plugin reads them by name.
No field mapping to set up. The plugin looks at each field's name, the way your form builder passes it, and picks the email and the name. The message someone typed is never sent. Pick your builder, then rename a field or change a value, and watch what it picks. Every lead lands in your lead attribution.
your form · sample · edit the names and values
Try: rename Name to Username. In Contact Form 7, rename Work email to Contact. Or change the email to ada at example.
what the plugin sees, and picks
email Work email #0email: the name holds "mail" and the value is an emailtext Name #1name: the name holds "name"text Company name #2skipped: "name" with company, business or usertextarea Message #3never sent: the plugin sends only an email and a name
{"external_ref": "wpforms-412",
"action": "contact",
"email": "ada@example.com",
"name": "Ada Lovelace"}
Sample form. The rules, in order: the first field whose name holds "mail" and whose value is an email; a first name (first, given, fname) and a last name (last, family, surname, lname); a name holding "name" but not company, business or user. No email by name? The first value that is an email. Skald keeps the name and email only when the site's Leads' names and emails setting is full.
[02] the visit
Join a WordPress form lead to the pages read before it
At the moment the form is sent, the plugin adds one hidden field, skald_vid, filled from Skald's script tag on the page. Your server reads it and sends it with the lead. Pick a set-up and press Send.
Visitor IDs are off by default. The person who runs your Skald server turns them on per site.
<form class="wpforms-form">
<input name="wpforms[fields][0]" value="ada@example.com">
<input name="wpforms[fields][1]" value="Ada Lovelace">
<textarea name="wpforms[fields][3]">…</textarea>
<input type="hidden" name="skald_vid" value="skv_Q2xh…"></form>
- skald('id')skv_Q2xh…
- $_POST['skald_vid']skv_Q2xh…
- $_COOKIE['skald_vid']not set
- the leadjoined to its visit
The tag gives the ID, the hidden field carries it, and Skald joins the lead to the pages read before it.
[03] for developers
Count a "Book a call" form as a demo, and keep the newsletter box out
Every form is a contact by default. Two WordPress filters, small functions your theme can run on the plugin's data, change that without touching the plugin: one sets the action, one changes the whole lead or drops it. Pick a form that was just sent.
add_filter('skald_leads_action', function ($action, $plugin, $fields) { return $plugin === 'gravity' ? 'demo' : $action; }, 10, 3); add_filter('skald_leads_lead', function ($lead, $plugin, $fields) { if ($plugin === 'cf7' && isset($fields['newsletter'])) { return false; } if ($plugin === 'wpforms' && !empty($fields['select Topic #2'])) { $lead['label'] = strtolower($fields['select Topic #2']); } return $lead; }, 10, 3);
the body sent to Skald
{"external_ref": "wpforms-412",
"action": "contact",
"email": "ada@example.com",
"label": "pricing"}
kept Contact forms · completed · label pricing
Sample forms and filters. A filter's $fields are the names the plugin sees in [01]. A label must be a short lowercase word (letters, digits, - or _); any other is kept without a label. An action that is not one short word is refused, and Last deliveries shows why.
[04] set up and the secret
Set up WordPress form tracking in four steps, and keep the secret out of the plugin
Three steps in Skald and WordPress, then one form to test it. The secret is best kept in wp-config.php, WordPress's own settings file.
- Make secret. Skald: Settings > Integrations > Your site's server (lead) > Make secret.
- Download the zip. In the same box, download
skald-leads.zipfor WordPress. It holds your site's address. - Upload and activate. WordPress: Plugins > Add New > Upload Plugin, choose the zip, then Activate.
- Send a form. Send one of your own forms, then look at Last deliveries in Skald.
define('SKALD_LEAD_SECRET', '<your-secret>');
where the plugin reads the secret · first one set wins · switch them
used wp-config.php. Each form is signed with it.
Download the plugin without the secret when wp-config.php or the environment holds it, so the plugin file never does.
[05] limits
Where the WordPress plugin stops
It tells Skald that a form was sent, when, and from which visit. Nothing more.
What it does not do
- It is tested against stand-in WordPress hooks in Skald's own tests. Each form builder's new releases are yours to check: send a test form after you install it or update a builder.
- It sends once and moves on. A lead lost on the way stays lost: Last deliveries shows what arrived.
- Contact Form 7 is heard only after its mail went out, so a form whose mail failed never becomes a lead.
- Contact Form 7 and Elementor keep no entry id, so each form sent gets a random reference that matches nothing in WordPress. Ninja Forms too, when it does not save submissions.
- Other form builders need Zapier, Make or n8n, or a lead file in your theme's code.
- Journeys need Skald's script tag on the page and visitor IDs on for the site. The lead counts either way.
- No secret, nothing sent: the plugin stays quiet rather than send an unsigned lead.
keep reading
More on WordPress form attribution
questions
WordPress form attribution FAQ
Straight answers, including what Skald does not do.
Which WordPress form plugins does it work with?
Contact Form 7, WPForms, Gravity Forms, Elementor Pro forms and Ninja Forms. The plugin listens to each one's own hook for a form sent. A form built with something else can reach Skald through Zapier or Make, or through a lead file in your theme's code.
Will the plugin slow down my forms?
No. It sends the lead in the background and does not wait for Skald's answer. If anything goes wrong, it gives up quietly: a lead lost is better than a form broken.
How does a form get joined to the visit?
With Skald's script tag on the page and visitor IDs on, the plugin adds a hidden field named skald_vid to each form as it is sent. It also reads the skald_vid cookie, which exists when sharing across subdomains is on. Without either, the lead is counted with no journey.
Where should the secret go?
Best in wp-config.php, as define('SKALD_LEAD_SECRET', 'your-secret'), or in an environment variable of the same name. Then download the plugin without the secret. Never put the secret in a page, a theme file in a public repository, or a chat.
Can a form count as a demo or a sign-up instead of a contact?
Yes, with a few lines of PHP. The filter skald_leads_action changes the action, for example by form. The filter skald_leads_lead changes the whole lead, or drops it when it returns false, for a form you do not want counted.
Does it send the name and email?
It looks for fields whose names hold mail and name, and sends them. Skald keeps them only when the site's Leads' names and emails setting is full; otherwise they are dropped when they arrive.
$ tail -f access.log | skald
See what AI does with your site. Free for 30 days.
No card. We set up hosted Skald for you within one working day, or you self-host it free. Every line of your log, sorted and added up.