Browser/SPA NRQL query examples

This document will explain how you can use NRQL to query and explore your Browser data, including SPA data.

View JavaScript errors

To view JavaScript errors, you'd run a NRQL query of the JavaScriptError event reported by Browser. For example:

SELECT * FROM JavaScriptError

Here's an example of JSON resulting from running this query, which includes JavaScriptError attributes.

"event": {
            "deviceType": "Desktop",
            "firstErrorInSession": true,
            "releaseIds": "{\"jQuery\":\"v3.1.1\",\"multiverse\":\"98e7ab6\"}",
            "appName": "Book Staging Multiverse",
            "errorClass": "Error",
            "errorMessage": "Script error message",
            "requestUri": "/synthetic-multiverse/",
            "userAgentName": "Chrome",
            "transactionName": "Unnamed Transaction",
            "userAgentVersion": "44",
            "appId": 950582,
            "userAgentOS": "Linux",
            "timestamp": 1502262005,
            "browserInteractionID": ,
            "parentEventId": 
          }

View sample SPA data

To run a NRQL query of your Browser SPA data, use the BrowserInteraction or AjaxRequest events. For example:

SELECT * FROM BrowserInteraction

Here are some examples of NRQL queries you can make of your SPA data. To see all Browser attributes, see Browser default attributes.

Count route changes and page loads

To count the route changes and page loads in the past day:

SELECT count(*) FROM BrowserInteraction SINCE 1 day ago
Average duration of route changes and page loads

To find the average duration of route changes and page loads in the past day:

SELECT average(duration) FROM BrowserInteraction SINCE 1 day ago    
Slowest route changes

To find the 10 slowest route changes in the past day:

SELECT average(duration) FROM BrowserInteraction WHERE category = 'Route change' SINCE 1 day ago FACET browserInteractionName   

To find the ten most popular route changes in the last day:

SELECT count(*) FROM BrowserInteraction WHERE category = 'Route change' since 1 day ago FACET browserInteractionName
Compare page load and route change throughput

To compare the throughput between page loads and route changes in the last day, at 1-hour increments:

SELECT count(*) FROM BrowserInteraction SINCE 1 day ago FACET category TIMESERIES 1 hour
Compare page load and route change performance

To compare the performance of page loads and route changes in the last day, at 1-hour increments:

SELECT average(duration) FROM BrowserInteraction SINCE 1 day ago FACET category TIMESERIES 1 hour
Create table using certain criteria

To create a data table of the average, minimum, and maximum Ajax counts for the 20 slowest route changes:

SELECT average(duration), average(ajaxCount), min(ajaxCount), max(ajaxCount) FROM BrowserInteraction WHERE category = 'Route change' SINCE 1 day ago FACET browserInteractionName LIMIT 20

For more help

If you need more help, check out these support and learning resources: