We're Hiring!

Mattermost Discussion Forums

Mobile users vs Webapp users

How can we identify the number of users coming on the server from mobile app vs webapp ?

Hi there.

While there is no feature available on the UI (System Console) to determine the sessions, you can actually capture this information in the Sessions table in the database.

The core SQL query looks something like this:

mysql> SELECT u.Username, s.Props FROM Sessions AS s LEFT JOIN Users AS u ON s.UserId = u.Id WHERE s.Props LIKE "%os%";
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Username     | Props                                                                                                                                                                                 |
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ahmad.danial | {"browser":"Desktop App/4.6.2","csrf":"cwicco9czib9mpmafszx34nq7e","isMobile":"false","isOAuthUser":"false","isSaml":"false","is_guest":"false","os":"Mac OS","platform":"Macintosh"} |
| ahmad.danial | {"browser":"Safari/14.6","csrf":"i4idxdamppy8fejypofh7wnqsa","isMobile":"false","isOAuthUser":"false","isSaml":"false","is_guest":"false","os":"iOS","platform":"iPhone"}             |
| ahmad.danial | {"browser":"Safari/14.1.1","csrf":"xbmciabi9bdwfq9qu5ymjo8uee","isMobile":"false","isOAuthUser":"false","isSaml":"false","is_guest":"false","os":"Mac OS","platform":"Macintosh"}     |
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)

As you can see here, I am logged in to 3 different sessions:

  • Desktop App/4.6.2
  • Safari/14.1.1
  • For the mobile app, it is not obvious but you can tell from the os and platform parameter in the Props column.

I hope that it will at least give you a rough idea on this. Thanks.

You can then expand from there depending on your need.