Skip to main content

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.

PackageTargetDescription
@whatap-npm/browser-reactReact 18, 19React Router route templates, Error Boundary errors
@whatap-npm/browser-nextjsNext.js 13.4 or laterApp Router and Pages Router route templates, router change times, error.tsx errors, server component error digests
@whatap-npm/browser-vueVue 3.3 or laterVue Router route templates, errorHandler errors
@whatap-npm/browser-nuxtNuxt 3.8 or laterVue plugin features plus Nuxt app errors, server render errors, chunk load failures
@whatap-npm/browser-angularAngular 16 or laterErrorHandler errors, route templates, per-phase router change times
@whatap-npm/browser-build-pluginBuild tools, Node 18 or laterAdds 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.

main.tsx
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 createBrowserRouter from @whatap-npm/browser-react/react-router-dom.
  • For applications that split screens with <Routes>, import Routes from the same path as well.

The following items are not collected with the default installation. Configure only the items you need.

ItemSetting
Router changesUse the plugin's createBrowserRouter or Routes, or apply trackRouter(router) to an existing router
Per-loader timeCreate routes that have loaders with the plugin's createBrowserRouter. Routers applied with trackRouter are not collected
Suspense fallbackWrap Suspense boundaries with WhatapSuspense
Component renderingOnly components specified with useWhatapRenderTracking or WhatapComponentTracker are measured
Store actionsApply 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
app/layout.tsx
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>
);
}
app/error.tsx
'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>;
}
instrumentation-client.ts
export { onRouterTransitionStart } from '@whatap-npm/browser-nextjs';
  • For Pages Router, call trackNextPagesRouter(Router) once in pages/_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.config with withWhatapNext from @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
main.ts
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, or true to measure all named components.
  • Store actions are collected with the plugin options pinia and piniaTiming: true for Pinia, and with the vuex option or trackVuex for Vuex. Set the pinia option to the Pinia store instance.

Nuxt​

Supports Nuxt 3.8 or later.

npm install @whatap-npm/browser-nuxt
nuxt.config.ts
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' },
],
},
},
});
plugins/whatap.client.ts
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 option hydrationMismatchDetails.
  • 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
main.ts
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() to providers of AppModule.
  • 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
vite.config.ts
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/vue to the Vue compiler option compilerOptions.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 collectUserClick and collectUserAction.
next.config.mjs
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 version option in the browser agent settings. If not specified, all data is aggregated as default_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 setting frameworkmaxrows.