Download Limitation

Hi there !

I’m totally blocked on Memberstack anf Webflow.
I want to establish a monthly download limit for users. When a member has a custom attribute with Memberstack set to false, this prevents them from downloading additional files. It blocks access to the external URL link of the button and displays a popup that suggests upgrading to download more files. If the custom attribute value is true, the member can click on the download button and proceed to download the document.
I would like your point of view :

Preview link :

This is my code :

  document.addEventListener('DOMContentLoaded', function() {
      const downloadButton = document.getElementById('DownloadButton');
      if (downloadButton) {
          downloadButton.addEventListener('click', function(e) {
              const divCanDownload = document.getElementById('div-candownload');
              if (divCanDownload) {
                  const canDownload = divCanDownload.getAttribute('data-ms-member');
                  if (canDownload === "false") {
                      e.preventDefault(); // prevents navigating to the external URL
                      const popup = document.getElementById('popup');
                      if (popup) {
                 = 'block'; // show the popup

Which part are you having difficulty with? Generally I’d setup this system as;

  • Function to capture and record the debit event
  • Function to determine remaining credits
  • Function to determine whether viewing is allowed and display the popup if not
  • Process to reset usage counts at the end of the month

It’s pretty easy to do 1 through 3 using MS user data fields directly, but #4 might be trickier, I’m not sure if there is an MS API that gives you access to that data.

How you do this also depends on whether your “months” are calendar months or based on the date of subscription, e.g. Jan 7 to Feb 7.

Another approach to #4 might be to store both that subscription start date and the total downloads. You can then calculate allotment ( e.g. total membership timeframe / 30 days ) and usage ( total downloads ). However it will work like Audible credits- they’ll accumulate when unused.

Hello, wondering you were able to resolve this. Would love an update as I am trying to implement this as well.