How to create user logs (events and data changes)

Hi all, what would you say is the best way to keep track of actions undertaken by a user, so I can report on them? Some examples of things I might like to see would be:

  • how often a user is active (and therefore which users are the most active)
  • when a user changed some of their data, and what it was changed from and to

as well as more standard stuff like when a user created a data record.

Are there any plugins or anything that make this easy?

I’ve read a few articles on the forum but nothing that really answers this…

Before i start, doing this in Bubble can be quite expensive on WUs.You could also consider trying 3rd party analytics such as Google Analytics, Clarity etc, but ofc doing your own analytics on bubble gives you more control.

Create a ‘Page is loaded’ workflow in a Reusable Element that is in all your pages. (The header is generally a good place to put it, but if you dont have one, create a RE and put it on all your pages.)
In this workflow you can record the user’s session. You could have a dataType called Activity, and in this workflow you would create a new activity. I would recommend you define a time interval after which a new Activity record cannot be created by the same user, otherwise if the user loads the page many times, too many Activity records would be created. I like using 12-24 hours depending on the app. I like creating an Activity field on the User Type, and adding the activity to it once its created. In the workflow i would check whether the User’s activity’s created date is less than current date time - interval. This avoids having to do a search on each page load.

This can get very expensive. But you would have to create a new datatype to record the changes.
What is the particular reason why you want this feature? Is it just so that you can report on it? I dont think you would be able to do any meaningful analytics from the tsunami of data you would receive. Trying to collect too much data is often a mistake.

Every database record has a native ‘Created By’ field. This field cannot be changed, so oftentimes its useful to create your own Created By field so you can change it/ account for Temporary Users creating new things and then logging into an existing account etc.

There will be plugins that make third party analytics integrations easier. You can check some out.

Thanks Nico, this is super-helpful!
One other approach I have been looking at is using Segment and then linking PowerBI or something, but I had read stuff about WUs that suggested this may be even more resource-heavy (note: I am not a developer but a founder, and learning as I go). If you think this may be a better approach in terms of WUs then I can instead spend some more time looking at this direction - right now my app is in beta test and I do have the time to future-proof it a bit if it saves a radical redesign further down the road.

Tbh I didn’t think Google Analytics had this level of BI-type reporting (I’ve already integrated it for basic website stats), but I haven’t really looked beyond the basics - if you think that may be a good route too then I can spend some more time looking at that.

I generally prefer to use my own analytics rather than relying on external third parties, so i cannot help much in finding a third party which suits you. Google Analytics offers User-ID feature which allows you to tie multiple sessions to the same user so that might help you a bit.

I find the process of meeting with the team to discuss exactly which data would be useful to collect, and then implementing it myself, to be much more beneficial than just integrating with a third party which provides dozens of dashboards filled with fluffy data which most people never use.
Integrating with GA and others to see the general trends of the website is great though.
On top of that you will be relying on Users accepting cookies on your website, and i have increasingly found that people tend to reject cookies these days, so the data you are collecting will also not be completely reliable.

2 Likes

“dozens of dashboards filled with fluffy data”… you are so right with this :slightly_smiling_face:

I’m going to start by doing my own based on what you’ve said. I don’t have a team (it’s just me right now), but ultimately the data analytics will be accessible by back end partners (banks) and although I know generally what they’d be looking for, it’s more a demo “pitch” for them at this stage.

Thanks so much for the advice, it’s appreciated.

1 Like

Possibly even better is having a lastActive date field on the user. This is downloaded on the page load with minimal WU implications. When Current date time > lastActive + 6 hours, create a new activity log. This way, you avoid having to fetch a separate Activity data type on every page load. Small saving but would add up, especially on an SPA where every time go to page is run, this logic will run too.

2 Likes