How do I pass UTM parameters from my URL to an embedded form on my wix site?

Hi there, I’m looking for assistance in passing UTM parameters from my URL to an embedded form on my wix site. From what I can tell so far, the main issue is that when you embed a code or a website into Wix it creates a sort of nested iframe. So the UTM codes that would be available to the parent iframe aren’t available to my embedded form. I have tried to create a script that will add the UTM to any iframe src tags it finds however because they’re sandboxed it doesn’t look like the script will load properly.

Here is the script I’ve used and having tested it in the head and body-bottom section, neither of them make a difference.

Do you have any suggestions or ideas on how I might find a workaround?

I would also love a solution to this. I’ve gone back to using Wix forms then Zapier to send the info into a CRM.

Hi!

did you guys figure it out? i’m dealing with the same issue.

Thanks!
Naama

Hi! use this!
import wixLocation from ‘wix-location’;

$w.onReady(function () {
const { utm_source, utm_medium, utm_campaign, utm_content, utm_term } = wixLocation.query;
$w(“#input-utmsource”).value = ${utm_source};
$w(“#input-utmsource”).hide();

$w(“#input-utmmedium”).value = ${utm_medium};
$w(“#input-utmmedium”).hide();

$w(“#input-utmcampaign”).value = ${utm_campaign};
$w(“#input-utmcampaign”).hide();

$w(“#input-utmcontent”).value = ${utm_content};
$w(“#input-utmcontent”).hide();

$w(“#input-utmterm”).value = ${utm_term};
$w(“#input-utmterm”).hide();

});

“input” is each form field.