I have a feeling this requires the database to be available to collect data. That's a bad pattern. No database can be up all the time and an application like this should not lose data.
Have a look at patterns that resolve this like Snowplow Analytics.
Have a look at patterns that resolve this like Snowplow Analytics.