Feat: Add analytics data in admin plugin, counts, users created, sessions actives, etc by (day, week, month) #97

Closed
opened 2026-03-13 07:33:06 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @Chris-Kode on GitHub (Oct 18, 2024).

Is your feature request related to a problem? Please describe.
Add more visibility about the data to the admin user, is very useful to admin purpose.

Describe the solution you'd like
I would like to have some endpoints, probably in the admin plugin, to provide more data about the service.

Describe alternatives you've considered
I dont know if its correct, to make it in the admin plugin, but a alternative can be make some "analytics" plugin, with a admin middleware, to try to mantain the functionality separated.

Originally created by @Chris-Kode on GitHub (Oct 18, 2024). **Is your feature request related to a problem? Please describe.** Add more visibility about the data to the admin user, is very useful to admin purpose. **Describe the solution you'd like** I would like to have some endpoints, probably in the admin plugin, to provide more data about the service. **Describe alternatives you've considered** I dont know if its correct, to make it in the admin plugin, but a alternative can be make some "analytics" plugin, with a admin middleware, to try to mantain the functionality separated.
GiteaMirror added the enhancementpluginwontfix labels 2026-03-13 07:33:07 -05:00
Author
Owner

@nathanielrich commented on GitHub (Oct 29, 2024):

you can handle this with the database.hooks.
https://www.better-auth.com/docs/concepts/database#database-hooks

@nathanielrich commented on GitHub (Oct 29, 2024): you can handle this with the database.hooks. https://www.better-auth.com/docs/concepts/database#database-hooks
Author
Owner

@svaraborut commented on GitHub (Dec 15, 2024):

Analytics are beyond the scope of this library. All the database records have common auditing fields like createdAt and updatedAt which allows for simple statistic queries. To achieve higher granularity e.g. true auditing and blaming you should use hooks and populate a separate table.

@svaraborut commented on GitHub (Dec 15, 2024): Analytics are beyond the scope of this library. All the database records have common auditing fields like `createdAt` and `updatedAt` which allows for simple statistic queries. To achieve higher granularity e.g. true auditing and blaming you should use hooks and populate a separate table.
Author
Owner

@svaraborut commented on GitHub (Dec 15, 2024):

We may consider to create an auditing plugin. This will still not achieve the requested functionalities to perform analytics, but will populate a separate table with admin/user actions for triage/auditing to adhere with sec certifications.

@svaraborut commented on GitHub (Dec 15, 2024): We may consider to create an auditing plugin. This will still not achieve the requested functionalities to perform analytics, but will populate a separate table with admin/user actions for triage/auditing to adhere with sec certifications.
Author
Owner

@dosubot[bot] commented on GitHub (Jun 13, 2025):

Hi, @Chris-Kode. I'm Dosu, and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You requested a feature to enhance the admin plugin with analytics data, including user counts and active sessions.
  • Nathanielrich suggested using database hooks to manage analytics data.
  • Svaraborut noted that analytics are beyond the library's scope but mentioned auditing fields for simple queries.
  • Svaraborut proposed an auditing plugin for admin/user actions, which Kinfe123 supported, but it won't fully meet analytics needs.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here.
  • If no updates are provided, the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jun 13, 2025): Hi, @Chris-Kode. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - You requested a feature to enhance the admin plugin with analytics data, including user counts and active sessions. - Nathanielrich suggested using database hooks to manage analytics data. - Svaraborut noted that analytics are beyond the library's scope but mentioned auditing fields for simple queries. - Svaraborut proposed an auditing plugin for admin/user actions, which Kinfe123 supported, but it won't fully meet analytics needs. **Next Steps:** - Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here. - If no updates are provided, the issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#97