Nuxt 3

Integration guide for Nuxt 3 applications with ad blocker detection

Installation

Target file: nuxt.config.ts

Quick Integration

Add the following script tag to your HTML. Replace the data-key value with your actual API key.

Script Tag
script: [
        {
          src: 'https://cdn.antiblocker.io/ab.js',
          'data-style': 'minimal',
          'data-key': 'abk_****',
          defer: true
        }
      ]

Complete Example

Here's a complete example showing where to place the script in your nuxt.config.ts file:

nuxt.config.ts
export default defineNuxtConfig({
  app: {
    head: {
      script: [
        {
          src: 'https://cdn.antiblocker.io/ab.js',
          'data-style': 'minimal',
          'data-key': 'abk_****',
          defer: true
        }
      ]
    }
  }
})

Configuration

Script Attributes

data-keyYour unique AntiBlocker API key (required)
data-styleDisplay style - choose one of 6 variants: "classic", "dark", "educational", "friendly", "minimal", or "urgent"

Implementation Notes

  • Add the script configuration to your nuxt.config.ts file
  • The defer attribute ensures the script loads without blocking page render
  • The script will be automatically included in all pages
  • Works with both SSR and SSG modes

Best Practices

Performance

Place script before closing </body> tag. The script loads asynchronously and doesn't block page rendering.

Testing

Test integration in staging environment before deploying to production. Verify script loads correctly.

API Key

Obtain your unique API key from the AntiBlocker dashboard. Never share your key publicly.

Monitoring

Track detection rates and user responses through the AntiBlocker analytics dashboard.