Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Embedded form losing UTMs: how to pass parent page params

CNV-357High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

An iframe is a page inside a page. Form tools such as HubSpot, Typeform and Jotform often give you an iframe embed code. The visitor lands on yoursite.com/demo?utm_source=google&gclid=abc, but the iframe loads the form provider's URL, which has none of those parameters.

Where the UTMs get lost
  1. Ad clickURL has utm_source and gclid
  2. Landing pageParent page keeps the parameters
  3. Iframe formLoads without the parameters
  4. Lead in CRMSource is blank or direct

The parent page has the UTMs, but the iframe never receives them.

Why it costs you leads or sales

Leads attributed by sourceExample numbers
Leads attributed by source (example)Paid search (before): 8 leads; Direct (before): 80 leads; Paid search (after): 76 leads; Direct (after): 12 leads031618807612Paid search (before)Direct (before)Paid search (after)Direct (after)leads

Example: 100 leads from paid search, before and after passing UTMs into the embed. Numbers are illustrative.

How to check if your site has it

Test it by hand
  1. Open the page with test parameters

    Visit your form page with ?utm_source=test&utm_medium=qa&utm_campaign=iframe-check&gclid=test123 added to the URL.

  2. Inspect the iframe

    Right-click the form, choose Inspect, and find the <iframe> tag. Look at its src. If your UTMs aren't in it, the embed can't see them.

  3. Submit a test lead

    Use a test email address and submit the form.

  4. Check the record

    Open the lead in your CRM or form tool. Source, medium, campaign and click ID fields should hold your test values.

How to fix it

Append the parent's parameters to an iframe srcjavascript
document.addEventListener('DOMContentLoaded', function () {
  var params = new URLSearchParams(window.location.search);
  var keys = ['utm_source','utm_medium','utm_campaign','utm_term','utm_content','gclid','fbclid','msclkid'];
  var frame = document.querySelector('iframe[data-pass-utms]');
  if (!frame) return;
  var url = new URL(frame.getAttribute('data-src') || frame.src);
  keys.forEach(function (k) {
    if (params.get(k)) url.searchParams.set(k, params.get(k));
  });
  frame.src = url.toString();
});
Pass the parameters by platform
  1. Add the script

    Place the snippet above after the iframe, or load HubSpot or Jotform embeds from script so you can set field values.

  2. Store parameters for later pages

    If the form is on a second page, save the parameters in a first-party cookie or sessionStorage on landing and read them there.

How to confirm it's fixed

Fix check
  • Load the page with test UTMs and a fake gclid.
  • Inspect the iframe: its src or fields now include the values.
  • Submit a test lead with a test email.
  • The CRM record shows source, medium, campaign and click ID.
  • Repeat on mobile and in a private window.
  • Test a second-page flow if the form isn't on the landing page.

How to prevent it happening again

How it usually goes wrong
  1. Week 1

    Form embedded and tested without UTMs. It works, so it launches.

  2. Week 2

    Ads send traffic. Leads arrive with blank source fields.

  3. Week 6

    Reports show paid search with few leads. Budgets are cut.

  4. After the fix

    Parameters passed in. Leads show the campaign that drove them.

Embed before and after

Before

  • Iframe src has no parameters
  • Hidden fields stay empty
  • CRM source shows direct

After

  • Parent UTMs copied into the embed
  • Hidden fields filled
  • CRM shows campaign and click ID

How FunnelGuard handles this

Questions people ask

Why is my embedded form not passing UTM parameters?

An iframe loads a separate page, so it can't see the query string of the page around it. Unless you copy the UTMs into the iframe's URL or into hidden fields, the form submits without them.

How do I pass UTM parameters to an iframe?

Read the parent URL with URLSearchParams, then add the values to the iframe's src before it loads. The form provider must accept those parameters and map them to hidden fields to store them.

How do I get UTMs into Typeform, Jotform or HubSpot?

Create hidden fields for source, medium, campaign and click ID in the form. Then pass values through the provider's supported route, such as URL parameters or form events. Details differ by provider, so check its current docs.

Can the iframe read the parent page's URL?

Not when it is on a different domain. Browsers block that for security. The iframe can only use what the parent passes in through its src or a provider setting.

Why does my CRM show direct traffic for form leads?

The lead was likely created inside an embed that received no UTMs, so no source was stored. Check the form's hidden fields and the iframe src on a page opened with test parameters.

Does this affect Google Ads conversions?

It can. Without the gclid stored with the lead, offline conversion imports can't match the lead to the click. Browser-side conversion tags may still fire, so test both.

How can I test if my embedded form keeps UTMs?

Open the form page with test UTMs, submit a test lead and check the CRM record for those values. A monitoring tool like FunnelGuard can repeat this check on a schedule.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: UTM persistence / payload.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.