SOLVED

Re: Can pass query string value to Marketo form that's in an iframe?

Go to solution
Jim_DiModica
Level 3

Can pass query string value to Marketo form that's in an iframe?

We have a form that captures the referrer value from the query string. The form has a hidden field for the referrer. It works HERE in a non-iframe situation.

We now want to use the iframe delivery method for a different form on a different page, so the form is loaded into a page on our web site via an iframe. I need it to capture the referrer (ref) value from the parent URL: i.e. xxx.com/static/400/?ref=DM

What script is required in the iframe page that has the form? Anything else?

Many thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Can pass query string value to Marketo form that's in an iframe?

Certainly it's possible operating fully within the IFRAME, and the building blocks were detailed by Dan Stevens on the discussion you just cross-posted to.

However, even easier -- if you control the outer page's code itself -- is to append the query param to the IFRAME src, so your form will see it like any other param.

In other words (pseudocode):

     NewIframe.src = 'http://pages.example.com/lp-with-form.html' + document.location.search;

Then you can use standard hidden fields, because the outer page's query string is also the IFRAME's query string.

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Can pass query string value to Marketo form that's in an iframe?

Certainly it's possible operating fully within the IFRAME, and the building blocks were detailed by Dan Stevens on the discussion you just cross-posted to.

However, even easier -- if you control the outer page's code itself -- is to append the query param to the IFRAME src, so your form will see it like any other param.

In other words (pseudocode):

     NewIframe.src = 'http://pages.example.com/lp-with-form.html' + document.location.search;

Then you can use standard hidden fields, because the outer page's query string is also the IFRAME's query string.