New Relic

New Relic: is a performance monitoring and observability platform that provides insights into the performance, reliability, and health of your software applications and infrastructure.

It is used to ensure real-time detection of issues, error tracking and Proactive alerting for timely resolution and enhanced system reliability.

How to use
  • Create a New Relic Application: request the new relic credentials, Log in to your New Relic account and create a new New Relic Browser application by selecting the frontend framework.
  • Get the New Relic Browser Code: Once your application is created, you'll be provided with a JavaScript snippet that you need to include in your web application.
  • Add the New Relic Browser JavaScript snippet Code to Your project:
# Create a js file in your public folder and paste the JavaScript snippet Code, remember to remove the script tag<script></script>
/public/newRelic.js
  • Open the app.vue file located in the project directory of your Nuxt 3 project.
<script>
export default defineNuxtComponent({
  setup() {
    const config = useRuntimeConfig();
    const isProduction = config.public.env === "production";

    useHead({
      script: isProduction
        ? [
            {
              src: "/newRelic.js",
              async: true,
              defer: true,
            },
          ]
        : [],
    });
  },
});
</script>
Ensure nuxt.config.ts includes:
export default defineNuxtConfig({
  runtimeConfig: {
    public: {
      env: process.env.NUXT_PUBLIC_ENV || "development",
    },
  },
});