How to dynamically display number of memberstack members on webflow site? Answered

Post author
Livi Anderson

We've been zoned in for a week and looking to work out the final kinks in the the project.

How can we display the number of members we have here on Memberstack on a page in Webflow.

Use case:

Building an eLearning community on Webflow. We want the "dashboard" for members  to display total member count and a few other things. Member count is primary.

Saw a site with that functionality on Webflow. Signed up immediately and found Memberstack as a membership management solution. 

Core question:

How do we dynamically display the number of Memberstack members we have on the Webflow website? 

The solutions we found that are not what we're looking for:

1. Memberscript 30 - we are not looking to count the number of items on a page

2. Finsweet code which counts the number of items in a CMS Collection as our member data is housed here and we do not want to be limited to 100 records.

3. Nocodelytics doesn't do simple member counts. That solution is for analytics but not for dynamically displaying the number of members in a Memberstack community to the members themselves.

A simple counting and display script that can pull the number of members we have on Memberstack and display a number that can be made visible to members as we grow is the core solution. 

Thank you for any guidance that can be provided here. 

Comments

9 comments

  • Comment author
    Josh Lopez

    Hey Livi Anderson

    Thank you for your question. As of right now we dont have a way to show the member count publicly without the workarounds you mentioned. I like your idea though! Can you make a feature request in the Product Wishlist section please so we can keep track of how popular it will be and not get lost? 🙏

    0
  • Comment author
    Livi Anderson

    Hey Josh Lopez - I found a way to do this dynamically and with no limitations using light automations and a really simple API tool I discovered over the weekend.

    Tested it and it works beautifully with Memberstack and Webflow. I'm new here so I'm not sure on the community culture and how to share solutions but I feel like I won the lotto. lol. Thanks for your response. 

    0
  • Comment author
    Josh Lopez

    Thats great to hear Livi Anderson! Please share it here in the forum or in our slack community!

    0
  • Comment author
    George Powell

    I want to display the current number of memberstack members in webflow frontend - any way to do this dynamically with api? Thanks team 💪

    0
  • Comment author
    Rhys Webber

    This should work mate 👌

    <script>
    document.addEventListener("DOMContentLoaded", function()
    { fetch('https://api.memberstack.io/v1/members', {
    method: 'GET',
    headers: {
    'Authorization': 'Bearer YOUR_API_KEY' // Replace with your Memberstack API key
    }
    })
    .then(response => response.json())
    .then(data => {
    const memberCount = data.length;
    document.getElementById('member-count').innerText = memberCount;
    })
    .catch(error => console.error('Error fetching member count:', error));
    });
    </script>
    0
  • Comment author
    Raquel Lopez

    Don't expose your secret api key in the frontend 🫣

    The admin API library is to be used in a server that protects it. You could use either Make or Wized to accomplish it without having to build a custom server

    0
  • Comment author
    George Powell

    Will it work if I use Memberstack v2?

    0
  • Comment author
    Duncan from Memberstack

    +1 to what Raquel Lopez said! I recommend using Make or Wized for this.

    Or...

    1. Leave it out (easiest solution)
    2. Manually update it every week to verify that it's worth building into your site.
    0
  • Comment author
    A J

    Hey future readers,

    You could customize this memberscript to show the total member count across all plans in your site.

    Hope this helps.

    0

Please sign in to leave a comment.