Skip to content
TraceLead

Typeform UTM tracking that remembers the visit before the form

Declare a few hidden fields in Typeform and TraceLead hands them the visit that found you: the Google ad, the newsletter, the search. The values go into the embed when the form loads, so the channel, campaign and gclid arrive with every response, even when the form sits on a page the visitor reached days later.

No card needed. No lead caps on any plan.

  • Typeform: Tested on every release against the builder's markup
  • How we test
Added to your Typeform responses Sample data

Added by TraceLead's hidden fields. The name and email stay in your form.

Channel
Paid search
Source / medium
google / cpc
Campaign
brand-uk
Click ID
gclid
Arrived from

Why passing UTM to an embedded Typeform loses the source

An embedded Typeform runs in a frame served by Typeform, not on your page, so no script on your site can fill its fields. The only way in is the embed itself: the hidden fields you declared, set when the form loads.

The usual fix copies today's query string into the embed. That only works when the visitor answers on the page they landed on, with utm_source still in the address. Arrive from an ad, read on, come back later, and the embed is handed nothing.

Two visits, one response Sample data
  1. Monday Clicks a Google ad, lands on /pricing?utm_source=google&utm_medium=cpc&utm_campaign=brand-uk&gclid=…, leaves.
  2. Thursday Types your address, opens /contact, answers the embedded Typeform.
Hidden field Copied from the address Handed over by TraceLead
channel empty paid_search
source empty google
utm_campaign empty brand-uk
gclid empty Cj0KCQjw…
landing_page empty /pricing?utm_source=google&utm_medium=cpc

TraceLead keeps the first visit in a first-party cookie on your own domain once your banner allows it. The embed is built from that record, wherever the form is.

How to fill Typeform hidden fields from the embed

Four steps: one in Typeform, three on your page. The tested pattern is the same for every embedded form; only the last call is Typeform's.

The full Typeform guide
  1. Add the TraceLead tag to your site

    Paste the one-line script tag on every page, with your site ID, and connect your cookie banner so TraceLead knows when it may store the first touch.

  2. Declare the hidden fields in Typeform

    In the form, open Settings → Hidden fields and add one per value you want, named like the TraceLead field: channel, source, medium, utm_campaign, gclid, landing_page, first_touch_at.

  3. Create the embed from a script

    Do not paste Typeform's embed code as it is. Load Typeform's embed library and create the widget once TraceLead has the stored touch, passing it as hidden. After 1.5 seconds without consent, the form appears without attribution.

    <div id="enquiry"></div>
    <script src="//embed.typeform.com/next/embed.js"></script>
    <script>
      window.tracelead = window.tracelead || function () { (window.tracelead.q = window.tracelead.q || []).push(arguments); };
      (function () {
        var KEYS = ['channel', 'source', 'medium', 'utm_source', 'utm_medium', 'utm_campaign', 'gclid', 'landing_page', 'first_touch_at'];
        var mounted = false;
        function mount(fields) {
          if (mounted) { return; }
          mounted = true;
          var hidden = {};
          KEYS.forEach(function (key) {
            if (fields && fields[key]) { hidden[key] = fields[key]; }
          });
          window.tf.createWidget('FORM_ID', { container: document.getElementById('enquiry'), hidden: hidden });
        }
        window.tracelead('touch', function (fields) { mount(fields); });
        setTimeout(function () { mount(null); }, 1500);
      })();
    </script>
  4. Test with a tagged visit

    Open your site with ?utm_source=test&utm_medium=cpc, accept cookies, then go to the page with the form and send a response. It should arrive with channel set to paid_search.

What arrives in your Typeform responses

Each hidden field you declared is stored with the response, beside the answers, and goes wherever your responses go.

Want more? Add any other TraceLead field, such as utm_term, referrer_host or a Microsoft, Meta or LinkedIn click id, to KEYS and declare a hidden field with the same name.

Typeform hidden field Holds
channel The channel the first visit came from
source Where it came from
medium How it came
utm_campaign The campaign name from your UTM tags
gclid Google Ads click id, for offline conversion import
landing_page The first page seen, sensitive parameters removed
first_touch_at When the first visit happened

Attribution without personal data. No names, emails, form values, IP addresses or user agents. Ever.

No privacy workarounds. Nothing before consent, no fingerprinting, no ad-blocker bypass, no cross-site identity.

Made in the UK. GBP pricing, UK consent rules in mind, and a person who answers email.

Questions, answered

Anything else? Email us and a person replies.

How do I pass UTM parameters to an embedded Typeform?

Declare hidden fields in Typeform, then create the embed from a short script instead of pasting Typeform's embed code. The script asks TraceLead for the stored first touch and hands it to the embed library's hidden option, so the values come from the visit that found you, not from the address of the page the form is on.

Do Typeform hidden fields have to be set up first?

Yes. Add them under Settings → Hidden fields, named exactly like the keys in the script: channel, source, medium, utm_source, utm_campaign, gclid and so on.

Can I use a Typeform link instead of an embed?

Yes. Typeform reads hidden fields from the fragment of a standalone link, for example https://form.typeform.com/to/FORM_ID#channel=paid_search&utm_source=google. Build that link from the same stored values in place of the embed.

What does the Typeform show before a visitor accepts cookies?

TraceLead stores nothing until your consent banner says yes. The script waits 1.5 seconds and then shows the form without attribution, because a form that never appears is worse than a response without a source. If consent arrives after that, the next page the visitor opens carries the values.

Does a later direct visit change the hidden field values?

No. TraceLead keeps the first touch for the lifetime you set, 90 days by default. A visitor who clicked an ad on Monday and comes back by typing your address on Thursday still reaches the Typeform as paid_search with the Monday campaign.

Does TraceLead see the answers in the Typeform?

No. Only the attribution values travel in the embed: channel, campaign names, click ids and the landing path. The answers go from the visitor to Typeform. Typeform stores the hidden fields you pass under its own terms, so pass only the ones you need.

What if TraceLead is down or blocked?

The form still appears after the 1.5-second wait, without attribution. Nothing in the Typeform depends on TraceLead.

Your next Typeform response, with its source.

Add the tag, declare the hidden fields and create the embed from the script. The form looks the same to the person filling it in.

No card needed. Cancel any time.

The whole install v1.4.0
Typeform → Settings → Hidden fields:
channel, source, medium, utm_campaign, gclid

Embed, built from the stored touch:
window.tf.createWidget('FORM_ID', { container: el, hidden: hidden });

The same values in a standalone link:
https://form.typeform.com/to/FORM_ID#channel=paid_search&utm_source=google