Nuxt.js provides several built-in methods for adding third-party scripts. Here are the recommended approaches for integrating Visitors analytics.
The cleanest approach is to add the script in your Nuxt configuration file.
Replace YOUR_TOKEN with your project token.
You can add the script using Nuxt's useHead composable in your app.vue or layout:
If you have @nuxt/scripts installed, you can use it for better script management:
Create a plugin for more control over the script loading: