30 Dec 2024 11:59 AM - last edited on 31 Dec 2024 07:25 AM by MaciejNeumann
I tried to retrieve web sessions for my web application to determine the network type (such as 3G or 4G) that users are using, but no sessions are being returned. Could you assist me in resolving this issue?
Here is the query I used:
SELECT * FROM usersession
This query works for mobile apps, and sessions are successfully retrieved. However, when querying for web app sessions, no data is returned. Could you please help me understand why the query works for mobile apps but not for web sessions?
30 Dec 2024 01:39 PM
Mobile apps often have more direct access to device and network information, while web applications are more restricted due to browser security measures as web browsers generally do not expose detailed network type information (like 3G, 4G, etc.) to web applications for privacy and security reasons,
You can add user session properties to you web applications with the dtrum API
https://www.dynatrace.com/support/doc/javascriptapi/interfaces/dtrum_types.DtrumApi.html#sendSession...
and the network information API https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API
30 Dec 2024 02:04 PM
@Aboud - you are looking for "Effective connection type" for web apps:
Mobile sessions list is as Network Technology and Connection Type:
I'll have to check, but I'm thinking there is a split between the two being Web Vs Mobile.
30 Dec 2024 09:33 PM
As per my knowledge it is not captured by web application, if you run below query, the connection type is "UNKNOWN" mostly.
Probably because of different browsers.
select connectionType FROM usersession WHERE applicationType="WEB_APPLICATION"
There is one way to capture this for one of the browsers:
NetworkInformation: effectiveType property - Web APIs | MDN
30 Dec 2024 11:32 PM
The mobile app session data attempts to obtain the details from device. It stores these within the user session table, which is why it can be queried.
Conversely, web applications has this data collected on a best effort basis from the browser network APIs (as Rohit pointed out). It means not all modern browsers support this, so it will often be missing. Furthermore, the browsers only support showing 2g, 3g, 4g up to 10Mbit/s from what I've seen. It's not much use at showing 'modern' downlink speeds (i.e. 200Mbit/s will still show as 4g, 10Mbit/s)
This is also not stored in the user session / actions table. Rather, it's stored in the waterfall analysis view of a user action and so it's only kept in short term retention for up to 10 days. It means it cannot be queried directly with USQL.
You will see this on the UA view:
But not on Mozilla Firefox: