[Question] Users analytics? #1443

Closed
opened 2026-02-05 00:54:34 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @lewildfox on GitHub (Nov 5, 2019).

Hello,

Quick question here, is there any users analytics (views, page created, etc) in the current release?
Thanks :)

Originally created by @lewildfox on GitHub (Nov 5, 2019). Hello, Quick question here, is there any users analytics (views, page created, etc) in the current release? Thanks :)
OVERLORD added the Question label 2026-02-05 00:54:34 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Nov 15, 2019):

Hi @lewildfox,
Nothing major in the system right now, focused on analytics.
There is a user-profile page that contains some very light stats.

On the database side, General activity such as creation, updates & deletions are recorded in the database along with user & entity (Book,Page,Chapter,Shelf) ids. View actions are also recorded, aggregated per-user, per-entity which I think also includes a last-viewed date.

So no interface right now (Has been requested and would be nice but complex to suit everyones needs and low priority in terms of development) but if you extract info from the database or hook an analytics suite/business intelligence tool to the database you'll likely be able to report on quite a lot.

@ssddanbrown commented on GitHub (Nov 15, 2019): Hi @lewildfox, Nothing major in the system right now, focused on analytics. There is a [user-profile page ](https://demo.bookstackapp.com/user/1) that contains some very light stats. On the database side, General activity such as creation, updates & deletions are recorded in the database along with user & entity (Book,Page,Chapter,Shelf) ids. View actions are also recorded, aggregated per-user, per-entity which I think also includes a last-viewed date. So no interface right now (Has been requested and would be nice but complex to suit everyones needs and low priority in terms of development) but if you extract info from the database or hook an analytics suite/business intelligence tool to the database you'll likely be able to report on quite a lot.
Author
Owner

@openmoto commented on GitHub (Dec 17, 2019):

Hi @ssddanbrown ,

Is there a way to add a script to every page instead?
Google Analytics requires that you a something like the script below to every page you want to track.
`

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxx-x"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-xxxxxxxx-x'); </script>

`
If one is just starting up, I'm guessing it can be added per page using HTML
However for a site already couple of hundreds of pages, it going to be too much waste of time editing each page. If we can be provided with a way to add a global script that is applied to every page, that would be great. At least for Google Analytics users.

Thanks

@openmoto commented on GitHub (Dec 17, 2019): Hi @ssddanbrown , Is there a way to add a script to every page instead? Google Analytics requires that you a something like the script below to every page you want to track. `<!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxx-x"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-xxxxxxxx-x'); </script> ` If one is just starting up, I'm guessing it can be added per page using HTML However for a site already couple of hundreds of pages, it going to be too much waste of time editing each page. If we can be provided with a way to add a global script that is applied to every page, that would be great. At least for Google Analytics users. Thanks
Author
Owner

@james-geiger commented on GitHub (Dec 18, 2019):

Hi @openmoto,

Google Analytics scripts can be placed in the Custom HTML Head Content /settings#setting-app-custom-head portion of your BookStack settings. Although user data cannot be added dynamically to the gtag, it will allow you to include Google Analytics on every page.

Per-user data, as @ssddanbrown mentioned, is aggregated in the database.

I utilize a combination of these methods for my analytics.

Hope this helps!

@james-geiger commented on GitHub (Dec 18, 2019): Hi @openmoto, Google Analytics scripts can be placed in the Custom HTML Head Content ```/settings#setting-app-custom-head``` portion of your BookStack settings. Although user data cannot be added dynamically to the gtag, it will allow you to include Google Analytics on every page. Per-user data, as @ssddanbrown mentioned, is aggregated in the database. I utilize a combination of these methods for my analytics. Hope this helps!
Author
Owner

@ssddanbrown commented on GitHub (Dec 18, 2019):

Yeah, spot on @james-geiger, The Custom HTML head content setting is ideal for that kind of thing.

Although user data cannot be added dynamically to the gtag

You could cheekily load the gtag script on DOMContentLoaded, Grab the user's ID from their profile link in the header bar, then send that off with the gtag events if you really need to tie up GA data to users; Obviously not an official way of doing things 😄

@ssddanbrown commented on GitHub (Dec 18, 2019): Yeah, spot on @james-geiger, The Custom HTML head content setting is ideal for that kind of thing. > Although user data cannot be added dynamically to the gtag You could cheekily load the gtag script on `DOMContentLoaded`, Grab the user's ID from their profile link in the header bar, then send that off with the gtag events if you really need to tie up GA data to users; Obviously not an official way of doing things :smile:
Author
Owner

@ssddanbrown commented on GitHub (Mar 6, 2020):

Since the original question was answered I'll close this.

@ssddanbrown commented on GitHub (Mar 6, 2020): Since the original question was answered I'll close this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1443