Answered

Passing merge tag data to embedded form

  • 5 February 2021
  • 4 replies
  • 596 views

If I’m sending a survey through MailChimp that includes a URL to a page with a survey embedded on it, and I want to pass the user’s email address using a merge tag, will this work? Would I just need to append the merge tag to the end of the page’s URL?

icon

Best answer by picsoung 6 February 2021, 01:31

View original

4 replies

Userlevel 7
Badge +5

Hi @SeenDating Ah, now I understand the comment on the other post ha! Did the post here help? Or do you still need help with hidden fields? :) 

Hi, it’s actually a different use case than the other thread, so I decided to start a new question.

Does the question make sense? If we’re sending users from MailChimp to our domain that has the survey embedded on it, how do we pass the merge tag data (ie: email address) to the embedded survey?

Userlevel 7
Badge +5

Hey @SeenDating

For this type of advanced usecase you will need to use our Embed SDK, which gives more control than the code snippets in the share panel.


In the SDK we added a `transferableUrlParameters` parameter that will grab query parameters from the parent window and pass them as hidden fields to the form.

 

here is the JavaScript snippet you could use
 

var url = "https://picsoung.typeform.com/to/QXS2h1" // NOTE: Replace with your typeform URL

const embedElement = document.querySelector('.target-dom-node') // NOTE: `.target-dom-node` is the target DOM element from your website or web app

window.typeformEmbed.makeWidget(
embedElement,
url,
{
transferableUrlParameters: ['utm_source', 'username'], //pass automatically from parent window to embedded typeform
onSubmit: function () {
console.log('Typeform successfully submitted')
}
}
)

 

And on glitch you will find a project with the whole example, easy to fork and remix for your own use.

Hope it helps 

Thanks for your help

Reply