Require login after second button click

Dear community. I launched my app ai-adventures.com that works with OpenAI API and generates travel itineraries. Until now it was free, however, with increased activity, I want to limit the API calls to 1 per month per user (clicks on magic in 3,2,1… button), unless logged in. If the user exceeds the 1 API call, I’d like a pop-up with the sign-up form to appear.

Can anyone guide me on how to do that in Bubble? The ideal solution should “remember” the user, so that reloading the page shouldn’t reset the count.

Thank you!

You can store the number of button clicks on the User data type.
Even when a user is not logged in, you can store data on the Current User thing - it’s what Bubble uses to track sessions.

Then all you need to do is add a conditional on your buttons to show a paywall if Current User’s #clicks > 2 AND Current User is logged out

Of course, clear the #clicks field once the user signs up - it won’t be necessary after that from what I see.

Thank you so much, exactly what I was looking for!

1 Like