Create a current streak

Hello! I am creating a daily reading app and want to incentivize people to read in it daily. How can I create a “streak” function that adds up the number of days in a row that a user accesses a specific tab in the app?

This can be achieved by adding a numeric field called ‘counter’ to your users collection and also a ‘last login’ or ‘last tab visit’ date field. Every time a user logs in or clicks a tab, update the ‘last login’ or ‘last tab visit’ with current date/time.

Also add an action on login or tab visit to update the ‘counter’ field with +1 if the current time is equal to or less than 1 day than ‘last login/tab visit’ field. Setup another action on login to set the counter field to 0 if current time is greater than 1 day from last login/tab visit.

Something to bear in mind when working with native apps is people have to manually logout as sessions on apps do not timeout. This might make your idea a lot trickier and would call for a different approach.

Let me know how this works out for you


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.