← All Scripts

#52 - Delayed Page Redirect v0.1

Redirect members to a new page with an optional delay.

Need help with this MemberScript?

All Memberstack customers can ask for assistance in the 2.0 Slack. Please note that these are not official features and support cannot be guaranteed.

View demo

<!-- 💙 MEMBERSCRIPT #52 v0.1 💙 DELAYED REDIRECT TO NEW PAGE -->
<script>
  const redirectToNewPage = function() {
    setTimeout(function() {
      window.location.href = "/your-page";
    }, 1000); // Delay in milliseconds
  };

  redirectToNewPage();
</script>
Description
Attribute
No items found.

This tutorial will guide you through adding a 1-second delay before redirecting the user to a new page. This can be useful in scenarios where you want to provide a brief message or notification to the user before they are redirected.

Step 1: Paste the Script

First, locate the global scripts section of your website, usually found before the closing `</body>` tag. Paste the script within that section:

Step 2: Customize the Redirect URL

In the script, locate the line `window.location.href = "/your-page";`. Replace `"/your-page"` with the desired URL of the page you want to redirect the user to. For example, if you want to redirect to a page called "/buy-credits", modify the line to `window.location.href = "/buy-credits";`.

Step 3: Adjust the Delay Duration (Optional)

By default, the script introduces a 1-second delay before the redirect. If you want to customize the delay duration, locate the line `}, 1000);` and modify the value `1000` (in milliseconds) to your desired time. For example, a delay of 4000 milliseconds equals 4 seconds.

Step 4: Save and Test

Save the changes to your website's code and test the functionality. When a user encounters this script, they will experience a 1-second delay before being automatically redirected to the specified page.

Creating the Make.com Scenario

1. Download the JSON blueprint below to get stated.

2. Navigate to Make.com and Create a New Scenario...

3. Click the small box with 3 dots and then Import Blueprint...

4. Upload your file and voila! You're ready to link your own accounts.