Collect ULR parameters to customize an iframe

Hi there,

We want to embed an external form on a wix landing page. The form is in an iframe.

On Instapage we used send a link to our users, that included parameters in the url. These parameters where then used to render an customized iframe. This is our process on instapage.

  1. We add a js script in the footer of the page (to make sure the script loads before the iframe), this buid the target:
const iframe = document.getElementById("sellerIframe"); iframe.src = "https: // app.xxx . com/login/?"  + window.location.search.substr(1)"
  1. We then use the code with the ID to display the personalized form
<iframe id="sellerIframe" title="Seller Form"    width=100%     height="740"> </iframe>
  1. We send a URL like this to our users:
"www. landingpage. com/?to=123456789"

where 123456789 is a unique identifier for that user.

We tried to add the same structure in wix, couldn’t manage to load the script on the page, thus iframe stays blank.

Anyone have a workaround or a simple solution to do this ?

Note: I’m not a developer :sweat_smile:

Note: I had to put some spaces in the urls to post this thread

Hi. it depends.
If you don’t need to set the

Thanks J.D for your help,

I tried to inject the code directly in the widget code but this doesn’t seem to even retrieve an iframe (I modified the url of course)

Don’t put it in the widget.
Put it in the webpage code panel (turn on the editor dev mode, if you haven’t done it already)

Thanks J. D.

Finally managed to implement it using part of the code you referred to and also naming the iframe in the right panel

Method for me:

  1. Create a widget on the page
  2. Open Dev Tool
  3. Select the widget
  4. On the right panel of dev tool replace it by the chosen name (eg. myForm)
  5. Add the below code on the page

//landing page:
import wixLocation from ‘wix-location’ ;
$w . onReady (() => {
const id = wixLocation . query ?. to ;
$w ( ‘#myForm’ ). src = “https://www.myform.com?to=” + id ;
})

Hope that helps someone else looking to do the same:

1 Like