The best way to keep track of user activity?

I’m thinking of two solutions:

  1. Have an Activity collection, where documents are activity records, which are inserted at the end of every method.


  1. Have an activity field on User documents, and push that user’s activity records into that array field.

I’m thinking solution 1 is better. Thoughts?

1 Like

What kind of user activity do you want to track - data changes? If so take a look at something like cwohlman:audited-collections (docs are lacking so take a look at the source). It allows you to capture snapshots of all data actions/changes, storing them in special audit collection. All you need to do is setup your collection like: SomeCollection = new AuditedCollection('some_name') and turn on snapshot logging with AuditLogs.logSnapshots().