How to delay login redirect in Memberstack 2.0 until member page automation completes?
Hello, I have recently migrated to Memberstack 2.0.
Previously, I had the following script on my welcome page, which redirected members to their member page after signup:
<script>
var Webflow = Webflow || [];
Webflow.push(function() {
MemberStack.onReady.then(function(member) {
if(member.memberPage){
window.location.replace(member.memberPage);
} else {
setTimeout(function() { location.reload(true); }, 3000);
}
})
});
</script>
However, this script no longer works in Memberstack 2.0.
I've set up an automation (in make) to create the member page and configure it in the login redirect. This automation takes around 10 seconds to complete. If the redirect happens too quickly, the login redirect page may not yet be created or configured.
Could someone help me update the script to work as it did in 1.0?
Comments
1 comment
Absolutely, I can help you with that! 😊 Since you're using Memberstack 2.0 and have an automation that takes some time to create the member page, we can modify your script to include a delay before checking for the member page. This way, it will give your automation enough time to complete.
Here's an updated version of your script:
Changes Made:
1. Added a setTimeout: This waits for 10 seconds before checking if the `memberPage` exists. This should give your automation enough time to create and configure the member page.
2. Retained the original functionality: If the member page is not available after the delay, it will reload the page after 3 seconds.
Feel free to adjust the delay time if needed! Let me know if this works for you or if you need further assistance. 😊
Please sign in to leave a comment.