Nuxt error tracking installation (v3.7 and above)
- 1
Install the PostHog Nuxt module
RequiredInstall the PostHog Nuxt module using your package manager:
Add the module to your
nuxt.config.tsfile:nuxt.config.tsPersonal API KeyYour Personal API Key will require
organization:readanderror_tracking:writescopes.The module will automatically:
- Initialize PostHog on both Vue (client side) and Nitro (server side)
- Capture exceptions on both client and server
- Generate and upload source maps during build
- 2
Manually capturing exceptions
OptionalOur module if set up as shown above already captures both client and server side exceptions automatically.
To send errors manually on the client side, import it and use the
captureExceptionmethod like this:VueOn the server side instantiate PostHog using:
server/api/example.js - 3
Build your project for production
RequiredBuild your project for production by running the following command:
TerminalThe PostHog module will automatically generate and upload source maps to PostHog during the build process.
- 4

