Usage Analytics, ACtive Users

Hi everyone.

I know this topic has been brought up before but following the thread, no solution has been given yet.

It seems most people are getting zero active users in Usage Analytics, which is hard to believe. Is there a way for us to check the number of users currently using the system, aside from the Users Logged in under Data Administration? And how effective is Usage Analytics?

Thank you.

Hi @Tangy

Thank you for your post.

Do you think it’d be a good idea to have the steps to reproduce this issue on Additionally, what is the version of the dhis2 instance that you are using?

Hi @Gassim ,
I am using version 2.39.3

Replicating this on the play instance might not exactly give the solution I am trying to find because I don not know how many users are active on this instance. I can’t not argue against any stats they pull out. But for arguement sake, I did try to and below is the results I got.

But at least active users is not zero as from my end.

1 Like

Hi @Tangy

I understand what you mean, thanks for the clarification! I see that in the Data Administration app, the number of users logged in during the day are 7 users whereas the Usage Analytics app shows that the number of active users during the day are 2.

Triaging this to @dhis2-platform

Thanks for the follow up!

I have taken a look at the code, and think there is a bug here.

For the active users obtained via the data administration app, this by simply calculating the number of users who have logged in since X days.

For the usage statistics app, there is a different way. You can read about this API here. DHIS2 apps can supply this information to the dataStatistics API, but there is no requirement to do this. In recent versions of DHIS2, many apps do not regularly report their usage to this API. However, in some versions of DHIS2 apps, these actions may not be reported at all, leading to undercounting of certain event types. Some of this has been fixed in very recent versions, but in general, it’s important to understand that they stats being reported in the usage statistics may be very much under representative of what is actually happening in your system.

After looking at the code and based on your report, it seems fairly certain that the usage statistics is not reporting these “active user” values as they should be. The method does not appear to be actually using the data statistics at all. I would for the time being just ignore these values, as they are clearly not correct.

In the meantime, you could create an SQL view which should give the the number of “active” users with this SQL query:

SELECT COUNT(*), date from (SELECT DISTINCT username, timestamp::date as date from datastatisticsevent ORDER BY username
) as active_users GROUP BY date;

You could of course adjust this as needed and keep in mind that the values may be severely under-reported due to the caveats I mentioned above.


@jason Thank you