Lesson notes
How it works
How Memberstack decides who can see a page
A gated content group is a rule you set in the Memberstack dashboard. It has a name, a list of restricted URLs, the members it grants access to, and an Access Denied URL. When someone opens a page, the Memberstack script on your site compares the page URL with your restricted URLs. If the page is restricted and the visitor is not a member with access, Memberstack sends them to the Access Denied URL instead.
Grant access to has two choices: all members, which means anyone who is logged in, or members on specific plans. You can add more than one plan to the same group. Each page or folder can only be gated once, so if you want two plans to reach the same page, add both plans to one group rather than making two groups.
This check runs in the browser. If Memberstack fails to load and someone knows the exact URL, they can reach the page. That is fine for most member areas. For things you sell, use hosted content, which comes later in this journey.
- In the dashboard, open Gated Content and click Add.
- Name the group. Keep it short, because Memberstack builds the group's content ID from the name.
- Under Grant access to, pick members on specific plans and choose your paid plan.
- Under Restricted URLs, choose Equal to and enter the page slug, for example
success-paid. - Enter your access denied page slug in Access Denied URL and click Save.
- Open the page in a logged-out browser window to check that you land on the access denied page.
Why you need an access denied page
You could send blocked visitors to your homepage, but a dedicated page tells them why they were stopped and what to do next, like upgrade or log in. The Components page in your Memberstack dashboard has ready-made access denied designs you can copy and paste into a blank Webflow page. Publish it before you point a group at it.
Don't gate your homepage. Visitors need at least one open page, and gating the homepage often causes a redirect loop.
How to show or hide one element with data-ms-content
Gating a URL blocks the whole page. To control one element on a page, add a custom attribute in Webflow with the name data-ms-content. The value decides who sees it.
data-ms-content="members" shows the element to anyone logged in. data-ms-content="!members" does the opposite: the exclamation mark flips the rule, so only logged-out visitors see it. To tie an element to a plan, use the content ID of a gated content group, for example data-ms-content="CONTENT-ID". You'll find the content ID on the group in the Gated Content page. Add ! in front to show the element to everyone without access, which is handy for upgrade prompts.