Typeform: member data & hidden fields

Article author
Josh Lopez

How to get member data into a Typeform embed with hidden fields to keep track of who is using your forms.

Starting resources:

What are hidden fields in Typeform
Using hidden fields in Typeform

 

Using Typeform in Webflow

Here are a few steps to embed Typeform with a hidden field from Memberstack in Webflow.

 

Step 1: Custom code embed component

In Webflow, place the following code where you want to see your Typeform in an embed component. To get this code to work for your individual Typeform account, you need to replace "https://yourname.typeform.com/to/abc123" with your share link from the form you want to use.

 

<div class="typeform-widget" id="typeform-memberstack" data-url="https://yourname.typeform.com/to/abc123?email=unknown" style="width: 100%; height: 100%;"></div>

typeform-share-link.JPG

 

Step 2: Bottom code before 

Place the following code in the page settings in the "Before </body> tag" field. This code will also require you to update the share link like above.

 

<script>
MemberStack.onReady.then(function(member) {
let memberEmail = member["email"];
if (member.loggedIn) {
let src = "https://yourname.typeform.com/to/abc123?email="+ memberEmail;
let typeformElement = document.getElementById("typeform-memberstack");
typeformElement.setAttribute("data-url", src);
return src
};
})
.then(() => {
typeformCode();
});
function typeformCode() {
var qs,
js,
q,
s,
d=document,
gi=d.getElementById,
ce=d.createElement,
gt=d.getElementsByTagName,
id="typef_orm",
b="https://embed.typeform.com/";
if(!gi.call(d,id)) {
js=ce.call(d,"script");
js.id=id; js.src=b+"embed.js";
q=gt.call(d,"script")[0];
q.parentNode.insertBefore(js,q);
}
}
</script>

 

webflow-bottom-code.JPG

Now you can use a hidden field in an embedded Typeform in Webflow! 🎉

Was this article helpful?

Comments

3 comments

  • Comment author
    Ignacio Ramognino
    • Edited

    Hi Josh, thanks you very much!


    Do i need to change this?

    let typeformElement = document.getElementById("typeform-memberstack");

    and

    id="typef_orm",
    1
  • Comment author
    Josh Lopez

    Hey there 👋

    You shouldn't need to unless Typeform changed their embed. The only thing you would need to change is the src:

    let src = "https://yourname.typeform.com/to/abc123?email="+ memberEmail;

    change "yourname" to the name of your typeform.

    0
  • Comment author
    Ignacio Ramognino

    thanks you very much! i can do it :)

    0

Please sign in to leave a comment.