Member data inside Webflow HTML embed

I use Webflow.
I have an attribute inside an html element (lets call it “trackEmail”) that I’d like to be the email address of the currently logged in user. Is it possible to fill this in from Memberstack data?

So I’d essentially like the HTML to be:
<div class=“myCustomElement” trackEmail="[ms-data = “email”]">

Any ideas?
Thanks in advance!


Hi @ajrengel,

Yes! That’s 100% possible but involves a bit of custom code. Here’s how to do it.

Step 1: Add an ID to the element. So like id="my-element"

Then here’s the code to make it work. Place this in the footer of the page.

    MemberStack.onReady.then(function(member) {
        var email = member["email"]

        var element = document.getElementById("my-element")



Thanks for the quick response! Would this work for multiple elements if I give them all the same ID? And what If I needed to reserve the ID for something else unique (like an anchor link), could I get the element via another attribute?

1 Like

Sorry I found out a bit more and can probably offer a bit more context. I’m looking to track Wistia video views using their “TrackEmail” tag:

Specifically, when I use playlists:

From what I can tell, it’s not a custom attribute I need to add to a div (which is the problem you solved earlier), but rather a class I need to add.

So I need a class to be added to a div, specifically:
trackEmail: "[logged-in-users-email]"

Hopefully your script can be tweaked a little to allow this! Along with my comment above that would allow for it to be applied to multiple matching divs through something other than ID.

Way to change the scope, I know! Thanks again for your help.

1 Like

I did it! Thanks to Google and a lot of guesswork (I don’t know Javascript). This allows anything with the class “wistia_embed” (which all Wistia embeds have by default) to have the class trackEmail=[member-email] added, and it works even if you have multiple Wistia embeds on the page:

MemberStack.onReady.then(function(member) {
	var email = member["email"]
  var trackedemail = "trackEmail=".concat(email)
  var x = document.getElementsByClassName("wistia_embed");
  var i;
  for (i = 0; i < x.length; i++) {

Thanks again for pointing me in the right direction!


Thanks for posting your solution!
I’m sure this will help others in the future :smiley:

I want to embed on a member’s page an embed code that is unique to thast user. I’ve created a new member field which will contacin the embed code. On webflow, is it possible to add an html widget and then have webflow inser the member’s unique embed code within that element?

1 Like

Hi James! I just merged your new post with this old one. if you need any help editing the code Tyler provided above, please let us know :smiley:

Hi @ajrengel I’m hoping to do the exact same thing as you. Where did you add this bit of custom code in Webflow? Head? Body?

Hey! I’m trying to read the notes my past-self made but need to look at the site I actually implemented it on to explore further and remind myself how I did it. Ill check tomorrow and I’ll post an answer ASAP.

1 Like

Ok, so my script snippet above goes into the footer for the whole site.

Here’s what it does:

  • Retrieves the email of the currently logged-in user from Memberstack and assigns it as a variable called “email”. So “email” = “”.
  • Creates another variable called “trackedemail”, which is just the string “trackEmail=” with the previous variable “email” concatenated onto the end. So “trackedemail” = “”. This is the new html attribute I need as one nice string.
  • Finally, the script looks for anything with the class “wistia_embed” and adds another class, with the value of “trackedemail”. In the specific case of Wistia playlist embeds, this result assigns the video view with the email address of the specific logged-in user.

Obviously you can find other script options to make this do what you need, which may include adding the “trackemail” string as an HTML attribute rather than an additional class, etc.

I hope this helps!

1 Like

Amazing!! Thank you for taking the time to explain.

1 Like


I am trying to do something somewhat similar (I think anyway). I want to create a form field that automatically fills with a member’s email. Anyone please got any clue how to do this?

1 Like

This one is easy! Just add a custom attribute to the field with the name data-ms-member and a value of email and you’re done!

Here is the full article from the helpful team at Memberstack:

1 Like