Browser Agent and SPA API
The New Relic Browser agent API lets you report additional data and events to New Relic Browser and New Relic Insights. Here are some important points to remember when using the API:
- The API relies on a
- The app's instrumentation level setting does not affect the availability of API functions.
If you use Browser's single-page application (SPA) monitoring, you can use the SPA API calls to add custom monitoring of specific browser interactions. This is useful for monitoring interactions that aren't recorded by Browser automatically because they don't result in route changes, such as a dynamically-updated widget. The SPA API also allows you to turn off monitoring for default-monitored interactions.
For an overview of all New Relic APIs, see Intro to APIs.
- actionText (Browser SPA API)
- Sets the text value of the HTML element that was clicked to start a browser interaction.
- Reports a Browser PageAction event to Insights along with a name and optional attributes.
- Records an additional time point as "finished" in a session trace, and sends the event to Insights.
- Identifies a browser error without disrupting your app's operations.
- Adds a user-defined attribute name and value to subsequent events on the page.
- Allows selective ignoring of known errors that the Browser agent captures.
- Groups page views to help URL structure or to capture the URL's routing information.
- SPA: createTracer
- Times sub-components of a SPA interaction separately, including wait time and JS execution time.
- SPA: end
- Ends the New Relic SPA interaction at the current time.
- SPA: getContext
- Stores values for the current SPA interaction asynchronously in New Relic Browser.
- SPA: ignore
- Overrides other SPA save() calls; ignores an interaction so it is not saved or sent to New Relic.
- SPA: interaction
- Returns a new API object that is bound to the current SPA interaction.
- SPA: onEnd
- Change the values associated with a SPA interaction before the interaction is saved .
- SPA: save
- Ensures a SPA browser interaction will be saved when it ends.
- SPA: setAttribute
- Adds a custom SPA attribute only to the current interaction in New Relic Browser.
- SPA: setCurrentRouteName
- Gives SPA routes more accurate names than default names. Monitors specific routes rather than by default grouping.
- SPA: setName
- Sets the name and trigger of a SPA's browser interaction that is not a route change or URL change.