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
DQL Examples 📖 Dynatrace Query Language (DQL) 📖 User sessions data model