Troubleshooting
Articles about how to solve the most common problems
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
xu_guo
Dynatrace Organizer
Dynatrace Organizer

Summary

This page provides a collection of commonly used USQL queries for Dynatrace, organized by performance metrics, user actions, applications, and limitations.

 

Page Performance Examples

Average Document Interactive Time (India)

SELECT starttime, AVG(useraction.documentInteractiveTime) AS "DOM Interactive" 
FROM usersession 
WHERE country = "India" 
GROUP BY starttime

Average Network Time (India)

SELECT starttime, AVG(useraction.networkTime) AS "Network time" 
FROM usersession 
WHERE country = "India" 
GROUP BY starttime

Top Server Response Time by Country

SELECT country, AVG(useraction.serverTime) AS "Servertime" 
FROM usersession 
GROUP BY country limit 5

Top Visually Complete Time by Country

SELECT country, AVG(useraction.visuallyCompleteTime) AS "Visually Complete" 
FROM usersession 
GROUP BY country limit 5

 

User Experience & Apdex

Frustrated User Actions by Country

SELECT country, COUNT(useraction.apdexCategory) 
FROM usersession 
WHERE useraction.apdexCategory = "FRUSTRATED" 
GROUP BY country limit 5

Apdex Distribution Breakdown

SELECT apdexCategory, COUNT(apdexCategory) 
FROM useraction 
WHERE apdexCategory != "UNKNOWN" 
GROUP BY apdexCategory

Apdex Breakdown for a Specific Application

SELECT apdexCategory, COUNT(apdexCategory) 
FROM useraction 
WHERE apdexCategory != "UNKNOWN" AND application="appnamehere" 
GROUP BY apdexCategory

 

Page & Session Counts

Page Load Count by Country

SELECT country, COUNT(useraction.name) 
FROM usersession 
WHERE useraction.name = "Loading of page /" 
GROUP BY country

Page Load Count for India

SELECT starttime, COUNT(useraction.name) 
FROM usersession 
WHERE useraction.name = "Loading of page /" AND country = "India" 
GROUP BY starttime

User Session Count for a Specific Application

SELECT DISTINCT DATETIME(starttime, 'MM-dd', '1d'), COUNT(*) 
FROM usersession
WHERE useraction.internalApplicationId = "APPLICATIONID"

 

Error Analysis

User Actions & Applications with HTTP Errors

SELECT DISTINCT useraction.name AS "User Action Name", useraction.application AS "Application", SUM(httpRequestsWithErrors) AS "HTTP Errors" 
FROM useraction WHERE httpRequestsWithErrors IS NOT NULL 
GROUP BY useraction.application, useraction.name, httpRequestsWithErrors 
ORDER BY sum(httpRequestsWithErrors) DESC 
LIMIT 20

Applications with HTTP Errors

SELECT DISTINCT useraction.application AS "Application", SUM(httpRequestsWithErrors) AS "HTTP Errors" 
FROM useraction 
WHERE httpRequestsWithErrors IS NOT NULL 
GROUP BY useraction.application, httpRequestsWithErrors 
ORDER BY sum(httpRequestsWithErrors) DESC 
LIMIT 20

Count of Specific JavaScript Error per Hour

select HOUR(usersession.startTime), usererror.name, count(usererror.name) from usererror where name="Script error." group by usererror.name,HOUR(usersession.startTime) order by usererror.name ASC

 

Browser, Bounce Rate & Funnels

Bounce Rate Per Page

SELECT useraction.name as "Page Name", COUNT(*) as "Page Views", COUNT(DISTINCT usersession.internalUserId) AS "Unique Page Views", AVG(useraction.duration) As "Average Session", count(bounce) as "# Bounce sessions" FROM usersession WHERE bounce IS true GROUP BY useraction.name

Users by Browser Version

SELECT COUNT(browserMajorVersion) as 'User Session Count', browserMajorVersion as 'Browser Version' FROM usersession GROUP BY browserMajorVersion

Sales Funnel Example

SELECT FUNNEL(useraction.name='xxxxx' AS "Visits Store", useraction.name= 'xxxxxx' AS "Views Product", useraction.name = 'xxxxx' AS "Starts Checkout", useraction.name= 'xxxxx' AS "Offer Upsells", useraction.name = 'xxxxx' AS "Complete Purchase") FROM usersession

 

Current Limitations in USQL

USQL does not support:
  • Counting redirects between URL A → URL B
  • Calculating success rates using aggregate formulas (e.g., errors / total)
  • Computing average time spent on each individual page
 
Note: Dynatrace Grail‑based DQL solves many of these queries. 
 

What's Next

You can ask questions on the Community or create a chat or Support ticket for assistance.
 

Further reading

Version history
Last update:
‎19 Feb 2026 05:19 PM
Updated by:
Comments
ChadTurner
DynaMight Legend
DynaMight Legend

This is a great list of USQL for users starting out! thanks for sharing this @xu_guo 

apasoquen1
Helper

Awesome examples!

alter
Observer

 

 

I agree this is a great post. Just the bounces part is misleading, since once the WHERE clause is bounce IS true, the number of "Page Views" will be the same as "Bounce sessions", since bounce sessions consist of exactly one page.

To get a better picture, a slight adjustment is needed:

 

SELECT useraction.name as "Page Name", COUNT(*) as "Page Views", COUNT(DISTINCT usersession.internalUserId) AS "Unique Page Views", AVG(useraction.duration) As "Average Session", CONDITION(COUNT(*) , WHERE bounce= true) as "# Bounce sessions" FROM usersession WHERE userType IS "REAL_USER" GROUP BY useraction.name

 

 

radek_jasinski
DynaMight Guru
DynaMight Guru

Very useful especially for users who are new to Dynatrace. Thank you!

Peter_Youssef
Leader

Hello @xu_guo 👩‍💻 :dynaspin:

Thank you so much for the organized and insightful examples.

DanielS
DynaMight Guru
DynaMight Guru

Thanks for sharing @xu_guo !!!!

Stephen1_Lee
Organizer

Would this give a reasonable avg duration per application and user action?

 

SELECT DATETIME(startTime, 'HH:mm', '5m'), avg (duration) FROM usersession WHERE
useraction.application='my app'
AND useraction.name = "my action"
GROUP BY DATETIME(startTime, 'HH:mm', '5m')