virling Pricing Self-host Demo Changelog Agencies GitHub Start free trial
blog / 2026-11-25

Typeform hidden fields UTM tracking: from form answer to payment

By Devendra Variya, co-founder of Virling. Published 2026-11-25.

To set up Typeform hidden fields for UTM tracking, declare one hidden field per tag in the form, then pass the values in the form link or through the embed code. Responses from tagged links then show their campaign, but not who paid. For that, carry a visitor ID in one more hidden field and join it to the payment later.

Typeform facts here come from its developer pages, its public embed library and one community answer, linked below and read on 2026-11-25. The help article in step 1 is linked for the clicks only. Typeform now calls hidden fields URL parameters too.

Start free trial

Step 1: declare the hidden fields

Add these six names to the form. The last one is only for Virling.

utm_source
utm_medium
utm_campaign
utm_content
utm_term
virling_vid

In the form builder, follow Typeform’s own article, how to add URL parameters, since menu names change. Keep every name in lowercase, and check that your plan includes the feature. If you create forms with the Create API, the names go in the hidden array of the form definition (source: Typeform, Form URL parameters):

"hidden": ["utm_source", "utm_medium", "utm_campaign",
  "utm_content", "utm_term", "virling_vid"]

Save and publish the form before you test.

Step 2: pass the tags in the form link

If people open the form on Typeform’s own address, put the values after a #, joined with &, with a space written as %20 (source: Typeform, Form URL parameters):

https://form.typeform.com/to/FORM_ID#utm_source=newsletter&utm_medium=email&utm_campaign=october-launch

On a link to your own site, tags go after ?. The UTM checker flags tags after a #, so use it for links to your site, not for this one.

A direct link has one cost: the form is not on your site, so your scripts do not run there. There is no visit and no visitor ID to join a payment to. If you want revenue, link to a page of yours with the form embedded.

Step 3: pass the tags in an embed

Short version: the form is on the landing page

List the names in data-tf-transitive-search-params. The embed reads them from the query string of your page and ignores every name that is not listed (source: Typeform, hidden fields in embeds):

<div data-tf-widget="FORM_ID"
  data-tf-transitive-search-params="utm_source,utm_medium,utm_campaign,utm_content,utm_term"></div>
<script src="https://embed.typeform.com/next/embed.js"></script>

It reads only the page it is on. A visitor who lands on your home page and then clicks through to the form has no tags left in the address, and it does not pass the visitor ID.

Full version: any page, with the visitor ID

The embed library also takes a hidden object and an onSubmit callback (source: Typeform embed library). Replace the short version with this, and FORM_ID with yours:

<div id="lead-form"></div>
<link rel="stylesheet" href="https://embed.typeform.com/next/css/widget.css">
<script src="https://embed.typeform.com/next/embed.js"></script>
<script>
addEventListener("load", function () {
  var query = new URLSearchParams(location.search), hidden = {};
  ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"].forEach(function (k) {
    hidden[k] = (window.leadUtm ? leadUtm.tags[k] : query.get(k)) || "";
  });
  hidden.virling_vid = window.virling?.vid?.() || "";
  window.tf.createWidget("FORM_ID", {
    container: document.querySelector("#lead-form"),
    hidden: hidden,
    onSubmit: function () { window.virling?.("goal", "demo request"); }
  });
});
</script>

leadUtm comes from the snippet in UTM parameters in hidden form fields, which keeps the tags in a first-party cookie. Put that on every page. Without it, the code reads only the page address.

The callback gives a response ID and no answers (source: Typeform, embed callbacks), so your page cannot learn the email from it.

What the form can and cannot tell you about revenue

  • It can tell you which tags a response came with, so you can count leads per campaign.
  • It cannot tell you who paid later. Invoices, renewals and refunds come after the form and are not part of the response.
  • It misses untagged visits. Search, AI answers and plain links bring no tags, so the fields are empty.
  • It holds one set of tags, not every visit the lead made before the form.
  • It is not proof. Anyone can edit a value in a link, so treat the fields as text a stranger typed.

A made-up example: campaign A brings 40 responses and 2 customers who pay $300 each. Campaign B brings 10 responses and 4 customers who pay $1,200 each. The form shows A ahead. The money is $600 for A, or $15 per response, and $4,800 for B, or $480 per response.

Join a lead that pays later

Virling does not read Typeform answers. It records the visit to your page with its tags, the goal, and the payment from your provider. To join them it needs the visitor ID or the email. Leave cookieless mode off: without the virling_vid cookie there is no visitor ID to carry.

By visitor ID, when the lead pays through your checkout

If the lead pays on your site in the same browser, your server reads the virling_vid cookie and needs nothing from the form. If you create the checkout from the saved lead, use the ID that came in the hidden field. For Stripe:

await stripe.checkout.sessions.create({
  client_reference_id: lead.virling_vid || undefined,
  // ...
});

The field for each provider is in link checkout to visits.

By email, when the lead pays an invoice

An invoice you send from Stripe carries no visitor ID, so it is matched by email. A Typeform webhook gives your server the hidden fields in form_response.hidden and the email in answers (source: Typeform, example webhook payload). Check the Typeform-Signature header first (source: Typeform, secure your webhooks), then send one identify event:

const r = payload.form_response;
const vid = r.hidden?.virling_vid;
const email = r.answers?.find((a) => a.type === "email")?.email;
if (vid && email) {
  await fetch("https://app.virling.com/api/event", {
    method: "POST",
    headers: { "User-Agent": "lead-form/1.0" },
    body: JSON.stringify({ n: "identify", u: "https://yourproduct.com/", s: "yourproduct.com", v: vid, m: email }),
  });
}

Do not send it without a visitor ID, or the email is tied to your server and not to the lead. Events with an empty or automated User-Agent are dropped. Virling keeps only a SHA-256 hash of the trimmed, lowercased email with a salt of your site. Cover both the email and the visitor ID in your privacy policy.

A Stripe, Shopify or WooCommerce payment with no visitor ID and the same payer email is then credited to that visitor and shows Matched by email. Matching is exact and applies to payments synced after the identify, so send it when the form is submitted. Pick a lookback window longer than your sales cycle; the default is 90 days. When the form leads to a booked call, Cal.com UTM tracking joins the booking to an invoice paid weeks later in the same way. The whole setup is in the sales-led B2B guide.

Using Tally instead? Read Tally form UTM tracking. For calls booked after the form, read demo booking revenue tracking. For a download or an email course, read lead magnet revenue tracking.

Test it in a private window

Use the full version and your own domain, on a live page and not on localhost. For the last step, connect Stripe with a test key.

  1. Open the form link from step 2 with utm_source=test and submit it. Expected: the response has test in utm_source. Virling shows no visit.
  2. Close it. In a new private window open https://yourproduct.com/demo?utm_source=test&utm_medium=email. Expected: Virling shows a visit from test.
  3. Run window.virling.vid() in the console. Expected: a visitor ID, not null or an error.
  4. Run document.querySelector("#lead-form iframe").src. Expected: after the #, utm_source=test, utm_medium=email and the same visitor ID.
  5. Submit the form with an email you can pay with. Expected: the response has the tags and the ID, and the visitor has a demo request goal in Virling.
  6. Look at the webhook on your server. Expected: the ID in hidden, and 202 from the identify call. A 202 means received, not matched.
  7. Send a Stripe test invoice to that email, pay it with a test card and wait a minute. Expected: the payment shows test and Matched by email, with the goal in its journey.

Then open the page in another private window without tags. The UTM fields should be empty and the form should still send.

Why the fields come back empty

ReasonHow to tellFix
Name not declaredThe value is in the link, but not in the responseDeclare it in the form, spelled the same, and publish
Visitor landed on another pageWorks on the landing page onlyUse the full version with the cookie snippet
Name not in the embed listOne tag arrives, another does notAdd it to data-tf-transitive-search-params
Placeholder left in the embedThe value is xxxxxRemove data-tf-hidden when you use the transitive attribute (source: Typeform community, 2022 answer)
Comma in data-tf-hiddenThe value is cut shortEscape it as \, or use JavaScript (source: Typeform embed library)
Sandbox modeNo response is saved at allTurn off enableSandbox (source: Typeform embed library)
Only virling_vid is emptyvirling.vid() gives nothingScript missing or blocked, cookieless mode, or a privacy signal you respect
No tags to begin withThe visit came from search or a plain linkNothing to fix: read its channel in Virling

Payments that cannot be joined still count toward revenue, as Unattributed. See unattributed revenue.

Frequently asked questions

How do I track UTM parameters in Typeform hidden fields?

Declare one hidden field per tag in the form, named utm_source, utm_medium and so on. Then put the values after the # of the form link, or pass them through the embed code. Each response then carries the tags.

Why are my Typeform hidden fields empty?

Usually the visitor landed on one page and filled in the form on another, so the embed found no tags in the page address. Other causes are a name that is not declared in the form or is spelled differently, a name left out of the embed code, and a visit that had no tags.

Does Virling read Typeform answers?

No. Virling does not connect to Typeform and never sees the questions or the answers. It sees the visit to your page, the goal your page sends, and the email your own server sends to it, which it keeps only as a salted hash.

Can Virling track a form opened on form.typeform.com?

No. Your script does not run there, so there is no visit and no visitor ID. Link to a page on your own site and embed the form in it.

How is a Typeform lead joined to a payment?

By visitor ID, if the ID goes into the checkout the lead pays through. Otherwise by email: your server sends the email and the visitor ID in an identify event, and a later Stripe, Shopify or WooCommerce payment with the same payer email is credited to that visitor.

See which form leads turn into payments

Virling is open source under AGPL. Self-host it free, or use the hosted version with a 14-day free trial. It connects to Stripe, Paddle, Shopify, WooCommerce, Polar, LemonSqueezy, Dodo, Creem and RevenueCat.

Start free trial See the demo