Do you have a way to track user online time (minutes)?
Now using workflow action every 60 seconds to add “1” to each user database, while this consumes much of WU, so trying to figure out how to still acculumate user’s minutes in the database with less WU.
It seems for the WU, every 60 seconds action is fine, but what happens after is that causes the WU spike, few workflow actions in the backend, one to change user database directly, another to change datatable linked to user directly, and two other workflow actions are with condition if yes or no (one of which triggered) to search in another datatable with around 20 rows of data.
I guess the issue is the consistancy that accumulates. Any suggestion how this could be managed? To reduce the data values, or to adjust current? Any other ideas? Thanks!
Is it not just a case of having a ‘minutesOnline’ number field on the user and increasing it by one? Why searches? If you need to do searches, why not have the searches run in a backend workflow only once per day that updates all of the other data and use the minutesOnline as a sort of live version?
Okay, do you state to create another data table or field in existing data table to store number of minutes where search is not required, and than to transfer the data to the bigger data table where all the insights are?
Can you explain why a search is required / your full workflow? That way I can suggest the most efficient method becauseI don’t understand what the searches are for!
Having one data table where all the app’s insights and metrics are, in this case the total user online time. Data table has rows, each row is one month long, around now we have 20 rows, so that the search searches the right row of the current month. It’s not big search, and it searches a slug name that is yyyy-mm.
By WU report and analysis donut, this workflow takes majority of the WU, and it seems the big issue is not in the search, rather in the 60 seconds of running the actions.
Having a ‘Monthly Data’ type is weird… Can’t you just have a data type called ‘Online Log’ which has a User, date (date), and duration (number) field? Every minute or whatever, create a new Online Log for the user with the relevant duration (e.g 2 for 2 minutes) and Current date/time.
Then to display online duration per day / week / month just use Do a search for Online Log:grouped by day/week/month.
No search necessary, just create something every X minutes (which isn’t ideal but hey, it seems like you need it).
Monthly data type is to see total online time per month, due to the company KPI’s. Good idea, maybe we can instead of 60 seconds, make it 120 seconds, although not sure if too wide gap for insights to be lost.
If the user online time is saved in one filed linked to user, it can’t be grouped by day/week/month or do I get it wrong here. To create some by X minutes, is the idea tu change 60 seconds to more minutes?
Yeah that’s up to you. More frequent = more accurate but more WU. I’ll use 1 minute in my examples below:
It’s not a field on the User. You create a Thing for each minute (1 DB entry per minute). So, have a ‘Do every 60 seconds’ that simply ‘Create a new Online Log’ with duration = 60, User = Current User and date = Current date/time (I mean you don’t technically need a date field as you could just use Created date).
If you wanted to calculate the total online time of a user, you just Do a search for Online Log[constraint: User = (the user)]:each item’s duration:sum which will sum all of the durations of the Online Logs for the user.
To display a user’s online time in a RG, you do:
Do a search for Online Log[constraints: User = (the user)]:grouped by date (day/week/month). Add an aggregation which is ‘sum’ of the ‘duration’. Then, each grouping will allow you to show the total duration per day/week/month in an RG.
Good idea, but this approach will create much of the data, if each 60 seconds to create one row, so that later on it could be searched and summarized, it could be accumulated data and search.
Although we will get option to do the groupping.
Maybe other members have insights here who work with user KPI’s? Thanks!
It’s not a problem. A grouped search only costs a little more WU than a regular search (and doesn’t return each result from the DB, only the group data i.e the sum and the date).
Yeah the table will get large but if that’s the only place you’re using it it won’t interfere with other parts of your app in terms of performance.
The ‘right’ answer here is probably to track user online time using Google Analytics or similar.
Understandable, but not sustainable solution I think, can’t create one table just for this case. We use Google Analytics. Thanks for the brainstorming here @georgecollier Let’s see if some other ideas come.
I am thinking also if possible to accumulate data somewhere and somehow, as to once per week or day to sum up and add to the final table, or maybe we need to give a time here, I feel the solution is right “outside” our box here Like we are looking at it as usually is the case
You can, it won’t slow down your app. You just have to remember that it’ll cost 0.5WU per user minute.
Sure, you could create a custom plugin that pings a server somewhere with the User ID every X minutes. Your server can update your Bubble DB daily/weekly or something. You might not even need a plugin - I’m not certain but if an API call is set to ‘make API call directly in the browser’ it shouldn’t cost any WU (and if it does, then that’s stupid)
Using web sockets seems a good solution here (to a Xano, Supabase or Node server). It will not consume WU and will be very very lightweight for the client.
That’s the process we used to integrate our active user monitoring feature within Flusk Vault
Thanks guys for pusshing this forward! Hope others learn! Have been partly introduced to the Web hooks, which goes from the backend and acts as a “sensor” once a condition is changed, example 60 seconds? Will try to explore this feature. Thanks!