Nuxt.js is a full-stack framework for JavaScript and TypeScript web applications. This guide covers setting up Real User Monitoring for an existing Nuxt.js application using the Raygun4JS provider.

In order to include Raygun4JS on each page in your application, we'll need to update the nuxt.config.js file so that it will add the Raygun setup code into the <head/> of the rendered document.

Open your nuxt.config.js file, in the root of your project. Add a script section, and a __dangerouslyDisableSanitizersByTagID section inside the head object; like in the example below.

This snippet does two main things.

  1. Fetches Raygun4JS from its CDN
  2. Enables Raygun4Js and Real User Monitoring

Your nuxt.config.js file should look similar to the following:

 head: {
    script: [
        hid: 'raygun',
        innerHTML: `
          h&&h(b,c,d,f,g),g||(g=new Error(b)),a[e].q=a[e].q||[],a[e].q.push({
        type: 'text/javascript'
        hid: 'raygunConfig',
        innerHTML: `
          rg4js('apiKey', 'paste_your_api_key_here');
          rg4js('enablePulse', true);
        type: 'text/javascript'
    __dangerouslyDisableSanitizersByTagID: {
      raygun: ['innerHTML'],
      raygunConfig: ['innerHTML']

  //Your other head config

It's necessary to use __dangerouslyDisableSanitizersByTagID to create an <script> tag with Nuxt.js. The primary risk from __dangerouslyDisableSanitizersByTagID occurs when including untrusted data in HTML. All of the provided examples are either static strings, or interpolate data directly from the process's environment variables. As such, there is no risk of these issues when using the examples as provided.

Note: If you encounter a situation where no events are appearing within Raygun, you may need to hard code the protocol so that the CDN matches your hosting environment. This could look like one of the following -


This will be in replacement of //

The provider is open source and available at the Raygun4js repository.