Forum Documentation Showcase Pricing Learn more

Tracking which days a user has used your app

I need to track what days a user has used the app, but only that - days. What I was going to do was have a workflow that saves the “Current date/time” to a list on the user called “Days Active”, and to not add it to that list if “Current date/time” is already on it. But this will stack up hundreds of times on each day if they are on it for a bit, because I can’t specify to disregard the time and only use the date.

How would you recommend tracking by day for a user?

1 Like

Save it to integromat making a post call. Push the data to a Google Sheet and maintain the data from there.

Unfortunately I need to reconcile the data in Bubble for analytics purposes. Search those dates, for example search specifically December 2019 to see which users registered, how many days until they fall off (1, 3, 7, 30, etc), and show the orders placed on which days on the same dashboard. It would be monumentally easier if I could a way to keep it all in-house. I will go that route if there’s no other option but any other ideas?

Your original post pretty much says exactly what you have to do:

  • Only push a new value for Days Active if the calendar day is not already represented in the list.

How do we know if two dates (which are unique points in time) happen on the same day (which is a range of time)?

… further: How you would do this in your context is to:

  • User’s Day’s Active (sorted by date descending) first item: formatted as MM-DD-YYYY is Current Date/Time: formatted as MM-DD-YYYY

:point_up: This will be true if the User has already been active “today”.

Duh, I knew there had to be a way to do that. That’s exactly what I needed, thank you @keith.

1 Like

Another slightly different way to do it (that’s a simpler idea, but rather harder to construct in the expression editor) is:

  • Current Date Time (set hours to 0 set minutes to zero set seconds to 0) < User’s Days Active (sorted by date descending):first item

:point_up: This will be true if the start of today is before the most recent Days Active (meaning that we already recorded a Days Active for today… and so should not create one)

OR conversely:

  • Current Date Time (set hours to 0 set minutes to zero set seconds to 0) > User’s Days Active (sorted by date descending):first item

:point_up: This will be true if the start of today is after the most recent Days Active (meaning that we have not yet recorded a Days Active for today… and so we can create one)

But personally, I prefer comparing the dates text-wise as I described before. The expressions above are carpal-tunnel inducing to create! (Also, there’s just the annoyance of having to do the Current Date Time modification first as you cannot construct that on the right hand side of the comparison.)

(The previous answer is more like how we’d do it in JavaScript or is one of the ways we could do it we are using a JavaScript library like moment.js. Though moment has an “is same interval” method as well – so you can do stuff like some_moment.isSame(some_other_moment, "day"), which returns true if the moments occur on the same day.)

EDIT: As a further aside, believe it or not, formatting the two dates as strings (text) and comparing for equality in “string space” is more performant (faster) than doing it datewise, at least the last time I checked.

And there are, of course, many other ways to make this same determination. Like, we could construct a date range that goes from the start of today to the start of tomorrow and ask if that range contains both the most recent Day Active and Current Date/Time. But that would be silly when the first option is so easy and fast. :slight_smile: