Installing browser framework plugins
With the browser agent alone, React, Next.js, Vue, Nuxt, and Angular applications are collected by actual page address. /users/42 and /users/43 are aggregated as different pages, and it is hard to tell on which screen an error from the router or a component occurred. If you also install a framework plugin, pages are aggregated by route template such as /users/:id, and you can check router change times and component errors in the Framework analysis menu. For how to use the screen, see Framework analysis.
Before installation
-
Apply the browser agent to the web page first. The plugin only calls public functions of the browser agent (
window.WhatapRUM) and does not send data directly. -
Route templates are collected with browser agent 3.3.0 or later.
-
Plugins are distributed as npm packages. Package names start with the
@whatap-npm/scope. Package versions are numbered separately from the browser agent, and all six packages share the same version number. The first version is 0.1.0.
| Package | Target | Description |
|---|---|---|
@whatap-npm/browser-react | React 18, 19 | React Router route templates, Error Boundary errors |
@whatap-npm/browser-nextjs | Next.js 13.4 or later | App Router and Pages Router route templates, router change times, error.tsx errors, server component error digests |
@whatap-npm/browser-vue | Vue 3.3 or later | Vue Router route templates, errorHandler errors |
@whatap-npm/browser-nuxt | Nuxt 3.8 or later | Vue plugin features plus Nuxt app errors, server render errors, chunk load failures |
@whatap-npm/browser-angular | Angular 16 or later | ErrorHandler errors, route templates, per-phase router change times |
@whatap-npm/browser-build-plugin | Build tools, Node 18 or later | Adds a component name attribute to the top-level element of each component, collects Next.js rendering modes (withWhatapNext) |
You can also check the same installation code in the Install framework plugins step on the Management > Agent Installation screen of the WhaTap monitoring service.
React
Supports React 18 and 19 with React Router 7 or react-router-dom 6.4 or later.
npm install @whatap-npm/browser-react
Import createBrowserRouter and ErrorBoundary from the plugin.
import { RouterProvider } from 'react-router';
import { createBrowserRouter } from '@whatap-npm/browser-react/react-router';
import { ErrorBoundary } from '@whatap-npm/browser-react';
const router = createBrowserRouter(routes);
createRoot(document.getElementById('root')!).render(
<ErrorBoundary fallback={({ error }) => <p>{error.message}</p>}>
<RouterProvider router={router} />
</ErrorBoundary>,
);
- With react-router-dom 6.4 or later, import
createBrowserRouterfrom@whatap-npm/browser-react/react-router-dom. - For applications that split screens with
<Routes>, importRoutesfrom the same path as well.
The following items are not collected with the default installation. Configure only the items you need.
| Item | Setting |
|---|---|
| Router changes | Use the plugin's createBrowserRouter or Routes, or apply trackRouter(router) to an existing router |
| Per-loader time | Create routes that have loaders with the plugin's createBrowserRouter. Routers applied with trackRouter are not collected |
| Suspense fallback | Wrap Suspense boundaries with WhatapSuspense |
| Component rendering | Only components specified with useWhatapRenderTracking or WhatapComponentTracker are measured |
| Store actions | Apply whatapReduxMiddleware for Redux and whatapZustand for Zustand |
The renderTiming option of the build plugin is not recommended in production.
Next.js
Supports Next.js 13.4 or later. The following is an App Router example. Use the same setting values as the browser agent installation script.
npm install @whatap-npm/browser-nextjs
import Script from 'next/script';
import { WhatapNextAppRouter } from '@whatap-npm/browser-nextjs/app';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
<Script id='whatap-config' strategy='beforeInteractive'>
{`window.WhatapBrowserAgent = { config: { projectAccessKey: "{PROJECT_ACCESS_KEY}", pcode: {PCODE}, sampleRate: 100, proxyBaseUrl: "{PROXY_BASE_URL}" } };`}
</Script>
<Script src='https://repo.whatap-browser-agent.io/rum/prod/v2/whatap-browser-agent.js' strategy='beforeInteractive' />
<WhatapNextAppRouter />
{children}
</body>
</html>
);
}
'use client';
import { useReportNextError } from '@whatap-npm/browser-nextjs';
export default function Error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
useReportNextError(error);
return <button onClick={reset}>Retry</button>;
}
export { onRouterTransitionStart } from '@whatap-npm/browser-nextjs';
- For Pages Router, call
trackNextPagesRouter(Router)once inpages/_app.tsx. This setting alone collects Pages Router router change times. - App Router router change times are collected on Next.js 15.3 or later when you add
instrumentation-client.ts. - Rendering modes such as static, ISR, and dynamic are collected when you install the build plugin and wrap
next.configwithwithWhatapNextfrom@whatap-npm/browser-build-plugin/next. - Rendering, store, and Suspense measurement work the same as in React.
Vue
Supports Vue 3.3 or later and Vue Router 4 or later.
npm install @whatap-npm/browser-vue
import { createApp } from 'vue';
import { whatapVue } from '@whatap-npm/browser-vue';
import App from './App.vue';
import { router } from './router';
const app = createApp(App);
app.use(router);
app.use(whatapVue, { router });
app.mount('#app');
- Component rendering is measured with the plugin option
trackComponents. Specify an array of component names to measure only those components, ortrueto measure all named components. - Store actions are collected with the plugin options
piniaandpiniaTiming: truefor Pinia, and with thevuexoption ortrackVuexfor Vuex. Set thepiniaoption to the Pinia store instance.
Nuxt
Supports Nuxt 3.8 or later.
npm install @whatap-npm/browser-nuxt
export default defineNuxtConfig({
app: {
head: {
script: [
{ innerHTML: 'window.WhatapBrowserAgent = { config: { projectAccessKey: "{PROJECT_ACCESS_KEY}", pcode: {PCODE}, sampleRate: 100, proxyBaseUrl: "{PROXY_BASE_URL}" } };' },
{ src: 'https://repo.whatap-browser-agent.io/rum/prod/v2/whatap-browser-agent.js' },
],
},
},
});
import { whatapNuxt } from '@whatap-npm/browser-nuxt';
export default defineNuxtPlugin((nuxtApp) => {
whatapNuxt(nuxtApp);
});
- Hydration mismatch locations are collected when you enable the build flag
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__and the plugin optionhydrationMismatchDetails. - Set rendering and Pinia action timing with the second argument, as in
whatapNuxt(nuxtApp, { trackComponents: [...], piniaTiming: true }). With@pinia/nuxt, Pinia is connected automatically. Vuex is not supported.
Angular
Supports Angular 16 or later. Add the browser agent script to <head> in src/index.html.
npm install @whatap-npm/browser-angular
import { bootstrapApplication } from '@angular/platform-browser';
import { provideRouter } from '@angular/router';
import { provideWhatap } from '@whatap-npm/browser-angular';
bootstrapApplication(AppComponent, {
providers: [provideRouter(routes), provideWhatap()],
});
- For NgModule-based applications, add
provideWhatap()toprovidersofAppModule. - Change detection time is collected with
provideWhatap({ changeDetectionTiming: true }). - NgRx store actions are collected with
whatapNgrxMetaReducer.
Build plugin
At build time, the build plugin adds a data-wt-component="component name" attribute to the top-level element of each component. When recording clicks and user actions, the browser agent reads this attribute and sends the component name along. Even if component function names are minified in the production build, the attribute value remains intact because it is a string. The build plugin runs only inside the bundler and is not included in the application bundle.
npm install -D @whatap-npm/browser-build-plugin
import react from '@vitejs/plugin-react-swc';
import { whatapComponentAnnotation } from '@whatap-npm/browser-build-plugin/vite';
export default defineConfig({
plugins: [whatapComponentAnnotation(), react()],
});
- For Vue and Nuxt, add
vueComponentAnnotation()from@whatap-npm/browser-build-plugin/vueto the Vue compiler optioncompilerOptions.nodeTransforms. - Angular does not support the build plugin.
- For Vite, add it before
react(). For Rollup, also add it before the plugin that transforms JSX. - For webpack, Rspack, and Next.js built with webpack, add the loader with
enforce: 'pre'. Next.js Turbopack builds have not been verified. - To collect clicks and user actions, enable the browser agent options
collectUserClickandcollectUserAction.
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
export default {
webpack(config) {
config.module.rules.push({
test: /\.(jsx|tsx)$/,
exclude: /node_modules/,
enforce: 'pre',
use: [{ loader: require.resolve('@whatap-npm/browser-build-plugin/webpack') }],
});
return config;
},
};
Common requirements
-
To use version comparison, specify the application version with the
versionoption in the browser agent settings. If not specified, all data is aggregated asdefault_version. -
In on-premises environments, update rumagent and rumstats on the collection server to versions that support framework analysis: rumagent 1.0.24 or later, and rumstats 2026-11-19 release (pkg-20261119) or later. Router change time distribution is also displayed from these versions.
-
In on-premises environments, if the
(other)row accounts for a large share of a table, raise the tag combination limit with the rumagent settingframeworkmaxrows.