Skip to content

Files

Latest commit

Feb 19, 2025
beced1f · Feb 19, 2025

History

History
151 lines (127 loc) · 5.69 KB

browserspa-nrql-query-examples.mdx

File metadata and controls

151 lines (127 loc) · 5.69 KB
title tags metaDescription redirects freshnessValidatedDate
Browser/SPA NRQL query examples
Query your data
NRQL: New Relic Query Language
NRQL query tutorials
New Relic NRQL: How to run queries of your browser and single-page application (SPA) data reported by Browser.
/docs/insights/new-relic-insights/adding-querying-data/query-spa-data-insights
/docs/insights/new-relic-insights/explore/query-spa-data-insights
/docs/insights/export-insights-data/export-options/query-spa-data-insights
/docs/insights/nrql-new-relic-query-language/nrql-query-examples/query-spa-data-insights
/docs/insights/nrql-new-relic-query-language/nrql-query-examples/insights-query-examples-new-relic-browser-single-page-app-data
/docs/insights/nrql-new-relic-query-language/nrql-query-examples/insights-query-examples-new-relic-browser-spa
/docs/query-data/nrql-new-relic-query-language/nrql-query-examples/insights-query-examples-new-relic-browser-spa
/docs/query-your-data/nrql-new-relic-query-language/nrql-query-tutorials/new-relic-browserspa-nrql-query-examples
/docs/query-spa-data-insights
/docs/browser/single-page-app-monitoring/use-spa-data/query-spa-data-new-relic
/docs/query-your-data/nrql-new-relic-query-language/nrql-query-tutorials/browserspa-nrql-query-examples
never

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

View JavaScript errors [#javascriptError-example]

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 [#explore-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.

To count the route changes and page loads in the past day:
```sql
SELECT count(*) FROM BrowserInteraction
SINCE 1 day ago
```

<Collapser id="avg-duration-route-change" title="Average duration of route changes and page loads"

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

```sql
SELECT average(duration) FROM BrowserInteraction 
SINCE 1 day ago
```

<Collapser id="slowest-route-changes" title="Slowest route changes"

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

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

<Collapser id="most-popular-route-changes" title="Most popular route changes"

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

```sql
SELECT count(*) FROM BrowserInteraction 
WHERE category = 'Route change' 
SINCE 1 day ago FACET browserInteractionName
```

<Collapser id="compare-throughput" title="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:

```sql
SELECT count(*) FROM BrowserInteraction SINCE 1 day ago FACET category TIMESERIES 1 hour
```

<Collapser id="compare-performance" title="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:

```sql
SELECT average(duration) FROM BrowserInteraction 
SINCE 1 day ago FACET category TIMESERIES 1 hour
```

<Collapser id="create-table" title="Create table using certain criteria"

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

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