MemberStack.io

Member data in HTML embed

I’m trying to pull member data (a unique URL) into an iframe. Has anyone been able to do this or something similar?

1 Like

Hi James! Html embed, yes, but iframe I’m not so sure.

I can’t get this to work with the recommended solution. Has anyone else tried this?

1 Like

Hello James! Can you provide a loom video explaining the situation please? Just trying to understand everything fully. :slight_smile: https://www.loom.com/

1 Like

I’m trying to insert a unique URL from a user’s memberstack profile into an HTML embed in Webflow. The URL is a dashboard for a marketing report. The URL should load as an iframe on the page.

For example:

Member: John
Url (in memberstack profile): [www.johnsuniqueurl.com/345678

Goal:

Get the Webflow HTML Embed to show the member’s URL in their profile as an iframe

1 Like

I wonder if something like this would work? I haven’t tested it yet but makes sense in theory lol. The only problem i can think of of memberstack not allowing the iframe because it might think the user isnt logged in.

the memberstack code added to the header would be changed to:

<script>
	let membershipId;
	MemberStack.onReady.then(function(member) {
		let email = member["email"];
		let name = member["first-name"];
		
		if (member.loggedIn) {
           // get the membership id to be used later
			membershipId = member.membership.id;
		}
	});
</script>

then on the page with the iframe this script would be added:

<script>
   window.onload = function(){
     if (typeof membershipId !== 'undefined' && membershipId) {
	    const root = location.protocol + '//' + location.host;
        // uses membershipId from memberstack script
        const iFrameSource = root + "/" + membershipId ;
        const iframe = document.createElement('iframe');
        iframe.frameBorder=0;
        iframe.width="300px";
        iframe.height="250px";
        iframe.setAttribute("src", iFrameSource);
        document.getElementById("report").appendChild(iframe);
     }
   }
</script>

and on the page you would just add a div with an id of “report” like:

<div id="report"></div>

1 Like