NoBlocky

Basic Adblock Detection Example

This example demonstrates the simplest way to use NoBlocky for adblock detection. Just call detectAdblock() and get results.

🔍 Checking adblock status...

How this works:

  1. NoBlocky selects optimal detection strategy based on browser
  2. Each strategy runs its configured detectors in parallel
  3. Results are analyzed across strategies for maximum confidence
  4. Final verdict includes detailed strategy and detector results
  5. All results are cached for performance on subsequent calls

📝 Code Example

This is the complete code needed to implement basic adblock detection:

import { detectAdblock } from 'noblocky';

async function checkAdblock() {
  try {
    const result = await detectAdblock();
    
    if (result.isBlocked) {
      console.log('Adblock detected!');
    } else {
      console.log('No adblock detected');
    }
  } catch (error) {
    console.error('Detection failed:', error);
  }
}

// Run the detection
checkAdblock();
		

💡 Tip: The basic example uses default settings which include multiple detection methods for maximum accuracy. You can customize the behavior with configuration options shown in the Advanced Example.

© 2025 NoBlocky. Adblock detection library.