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.
- Ad clickURL has utm_source and gclid
- Landing pageParent page keeps the parameters
- Iframe formLoads without the parameters
- 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
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
Open the page with test parameters
Visit your form page with
?utm_source=test&utm_medium=qa&utm_campaign=iframe-check&gclid=test123added to the URL.Inspect the iframe
Right-click the form, choose Inspect, and find the
<iframe>tag. Look at itssrc. If your UTMs aren't in it, the embed can't see them.Submit a test lead
Use a test email address and submit the form.
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
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();
});Add the script
Place the snippet above after the iframe, or load HubSpot or Jotform embeds from script so you can set field values.
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.
Add the iframe with a data-src
In a Custom HTML block, paste the iframe using
data-srcand thedata-pass-utmsattribute.Load the script
Add the snippet with a header and footer scripts plugin or your child theme, so it runs on that page.
Create a Custom HTML tag
Paste the snippet in a Custom HTML tag.
Trigger on the form page
Use a DOM Ready trigger limited to the pages that hold the embed. Publish and test in Preview mode.
Use an Embed element
Add the iframe with
data-srcin an Embed element.Add the script
Put the snippet in the page's Custom Code, before the closing body tag, then publish.
Use a Custom HTML/JS element
Add the iframe and the snippet in a custom code element on the funnel page.
Check form fields
If you use a GoHighLevel form, add hidden fields for UTMs and make sure they are filled from the URL. Confirm with a test lead.
Use an Embed code element
Add the HTML iframe through Embed Code. Wix runs embeds in their own frame, so the page URL may not be readable there.
Consider a native form
If the parameters still don't arrive, use a Wix form or Velo code to read the URL and pass values on.
Add a Code Block
Paste the iframe in a Code Block with the display-source option off.
Add the script
Put the snippet in Settings > Advanced > Code Injection > Footer.
How to confirm it's fixed
- 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
Week 1
Form embedded and tested without UTMs. It works, so it launches.
Week 2
Ads send traffic. Leads arrive with blank source fields.
Week 6
Reports show paid search with few leads. Budgets are cut.
After the fix
Parameters passed in. Leads show the campaign that drove them.
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.
Related issues
- CNV-353Embedded form (HubSpot, Typeform, Jotform) doesn't loadFix guide
- CNV-354Iframe blocked by X-Frame-Options/CSPFix guide
- CNV-356Embed form success message not visible to parent pageFix guide
- CNV-358Third-party cookies blocked break embed (Safari ITP)Fix guide
- CNV-355Iframe height fixed, submit button cut offFix guide
- CNV-359Embed provider account suspendedFix guide