Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Relic Solution: AJAX request data in Browser: how we record it and where to find it

browser
ajax
levelup
fetch

#1

Did you know that the Browser agent is capable of collecting two different types of AJAX data? It’s true. Depending on the circumstances, AJAX requests may be recorded as either:

  • Event data
  • Metric timeslice data

For a more detailed discussion on the distinction between the two types of data, check out New Relic Data Types.

This is confusing, I know, but it’s important to understand how each of these data types are generated in order to know where to find your data. So let’s talk about that!

AJAX metrics

  • Requirements: the Pro or Pro+SPA Browser agent and a Pro subscription
  • Where you can find it: in your Browser application’s AJAX view

We record metric data for all requests made using XMLHttpRequest, regardless of when or where in the application these occur. They are harvested by the agent along with JavaScript errors and reported to our endpoint http://bam.nr-data.net/jserrors.

Notice that I specified that this applies to requests made to XMLHttpRequest. Requests made using the Fetch API, on the other hand, are handled a little differently and will not generate metric data. For those requests, you’ll need to look to our next data type…

AJAX events

In order to understand this data, you first need to understand that a BrowserInteraction event includes not just the initial triggering user interaction, but also the resulting AJAX requests. (See our support document for more information on SPA data collection.)

Any requests that happen within the course of a BrowserInteraction, whether that request is made using Fetch or XMLHttpRequest, will be recorded as an AjaxRequest event along with a variety of default or custom attributes. They will be reported along with the associated BrowserInteraction data to http://bam.nr-data.net/events.

If the request was not made during a BrowserInteraction - for example, if it was made after a route change was completed - it will not generate an AjaxRequest event.

If you ever want to see how many AjaxRequest events were reported along with any given BrowserInteraction, you can examine the BrowserInteraction event in a query and look for the ajaxCount attribute - this will tell you how many requests were included in the timing of that interaction.

To summarize: is the data really missing, or are you just looking for it in the wrong place?

If the request is made using Fetch:
Assuming you meet the requirements noted above for Ajax request event data, you should be looking for the data in either an AjaxRequest event query or in the SPA PageViews breakdown.

If the request is made using XMLHttpRequest:
You should be able to find it in the AJAX view of the Browser UI. If it was made during a BrowserInteraction however, it should also be reported as event data and you can locate it as noted above.