Custom Code: Refreshing Page to Memberstack Custom Field

Hey all!

I’ve written a small script where I’m trying to pull a custom field value from memberstack (which is URL) and then refresh the page to that URL. Sort of like a custom redirect.

Any idea on what could be wrong?

<script>


setTimeout(function() {
  memberstack.onReady.then(function(member) {
    var customFieldValue = member.customField("tf-poc-1as-url");
    if (customFieldValue) {
      window.location.href = customFieldValue;
    } else {
      console.error("Error: tf-poc-1as-url field not found or is empty");
    }
  });
}, 5000);


</script>

Here is my site Read-Only: Webflow - The Attributes

Hey Nicholas!

You may need to share a live link for this one so it can be debugged