Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This will add meta data to the member profile in Memberstack which allows us to hide or show the mark as complete form.
<script src="" data-memberstack-id="[GET FROM MEMBERSTACK]"></script>
MemberStack.onReady.then(async function(member) {
// Checks if member is logged in
const metadata = await member.getMetaData();
// If no exists, create it in MemberStack.
metadata.videos = metadata.videos || [];
// Defines the webflow video ID to a const of itemID (Pull this from the CMS)
const itemID = "[GET FROM CMS]"
// If they have the item ID in their profile, hide the form, show the 'completed button'
document.getElementById('mark-as-watched').style.display = 'none';
document.getElementById('video-complete').style.display = 'block';
// When the button is clicked, if the itemID doesn't exist on their profile
// add it, then push the metadata to MemberStack.
if(metadata.videos.indexOf(itemID) === -1){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment