npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

adgate

v1.0.2

Published

Robust anti-adblock solution for modern websites. Lightweight, undetectable, and effective.

Readme

AdGate

Robust anti-adblock solution for modern websites. Lightweight, undetectable, and effective.

npm version npm downloads License Size JavaScript


🚀 Installation

CDN (unpkg)

<script src="https://unpkg.com/adgate/js/lib.js"></script>

npm

npm install adgate

Import in your project:

import "adgate/js/lib.js";

🔍 Why AdGate?

Most anti-adblock solutions are easily bypassed or detected. AdGate uses 8 advanced detection methods with async processing, smart timeouts, and self-protection to ensure your content stays protected.

New in v2.0:

  • ✅ Async/await architecture
  • ✅ Promise-based detection
  • ✅ Configurable sensitivity
  • ✅ Whitelist support
  • ✅ Theme customization
  • ✅ Bot detection
  • ✅ Performance optimized

⚡ Quick Setup

Basic Integration

<script src="https://unpkg.com/adgate/js/lib.js"></script>

Advanced Configuration

<script>
window.AdGateConfig = {
  sensitivity: 'high',
  theme: 'dark',
  whitelist: ['localhost']
};
</script>
<script src="https://unpkg.com/adgate/js/lib.js"></script>

🛠 Configuration Options

window.AdGateConfig = {
  // Detection sensitivity
  sensitivity: 'medium',        // 'low', 'medium', 'high'
  
  // Retry interval in milliseconds
  retryInterval: 30000,         // Default: 30 seconds
  
  // Domains to skip detection
  whitelist: ['localhost', 'dev.example.com'],
  
  // UI theme
  theme: 'dark'                 // 'light' or 'dark'
};

Sensitivity Levels

| Level | Description | Detection Rate | Performance | |-------|-------------|----------------|-------------| | low | Basic detection only | ~70% | Fastest | | medium | Balanced approach | ~85% | Optimal | | high | All methods enabled | ~95% | Slower |


🔍 Detection Methods

Network Tests

  • Ad server connectivity
  • Resource loading failures
  • Fetch API monitoring

DOM Analysis

  • Hidden element detection
  • CSS property analysis
  • Style injection tests

Performance Tests

  • DOM manipulation timing
  • Script execution delays
  • Resource loading speed

Advanced Detection

  • Mutation observer tracking
  • Browser extension scanning
  • Web worker blocking tests
  • Error event monitoring

🌍 Browser Support

✅ Chrome 60+ ✅ Firefox 55+ ✅ Safari 12+ ✅ Edge 79+ ✅ Mobile browsers ✅ IE11 (limited)


📦 Integration Examples

Basic HTML

<!DOCTYPE html>
<html>
<head>
  <title>My Website</title>
</head>
<body>
  <!-- Your content -->
  <script src="https://unpkg.com/adgate/js/lib.js"></script>
</body>
</html>

WordPress

function add_adgate() {
    wp_enqueue_script('adgate', 'https://unpkg.com/adgate/js/lib.js', array(), '2.0.0', true);
    
    // Add configuration
    wp_add_inline_script('adgate', '
        window.AdGateConfig = {
            sensitivity: "high",
            theme: "dark",
            whitelist: ["' . $_SERVER['HTTP_HOST'] . '/wp-admin"]
        };
    ', 'before');
}
add_action('wp_enqueue_scripts', 'add_adgate');

React/Next.js

import { useEffect } from 'react';

function MyApp() {
  useEffect(() => {
    // Configuration
    window.AdGateConfig = {
      sensitivity: 'medium',
      theme: 'light'
    };
    
    // Load script
    const script = document.createElement("script");
    script.src = "https://unpkg.com/adgate/js/lib.js";
    script.async = true;
    document.body.appendChild(script);
    
    return () => {
      document.body.removeChild(script);
    };
  }, []);

  return <div>Your app content</div>;
}

Vue.js

<template>
  <div id="app">
    <!-- Your content -->
  </div>
</template>

<script>
export default {
  mounted() {
    window.AdGateConfig = {
      sensitivity: 'high',
      retryInterval: 25000
    };
    
    const script = document.createElement('script');
    script.src = 'https://unpkg.com/adgate/js/lib.js';
    document.head.appendChild(script);
  }
}
</script>

🎨 Customization

Theme Options

// Dark theme (default)
window.AdGateConfig = { theme: 'dark' };

// Light theme
window.AdGateConfig = { theme: 'light' };

Whitelist Configuration

window.AdGateConfig = {
  whitelist: [
    'localhost',
    'dev.example.com',
    '192.168.1.100'
  ]
};

Development Mode

// Skip detection in development
window.AdGateConfig = {
  whitelist: ['localhost', '127.0.0.1'],
  sensitivity: 'low'
};

📊 Analytics Integration

Google Analytics 4

// Add after AdGate script
window.addEventListener('adblock-detected', function() {
  gtag('event', 'adblock_detected', {
    event_category: 'AdGate',
    event_label: 'Blocked Content'
  });
});

Custom Analytics

window.AdGateConfig = {
  onDetect: function(method) {
    // Your analytics code
    analytics.track('Adblock Detected', {
      method: method,
      timestamp: Date.now()
    });
  }
};

🐞 Troubleshooting

Script not working?

  1. Check browser console for errors
  2. Verify script loads after DOM
  3. Test in incognito mode
  4. Check Content Security Policy rules

Too many false positives?

window.AdGateConfig = {
  sensitivity: 'low',           // Reduce sensitivity
  retryInterval: 60000,         // Increase retry interval
  whitelist: ['your-domain.com'] // Add to whitelist
};

Performance issues?

window.AdGateConfig = {
  sensitivity: 'medium',        // Use medium sensitivity
  retryInterval: 45000         // Increase retry interval
};

Development Environment

// Disable in development
if (location.hostname === 'localhost') {
  window.AdGateConfig = { whitelist: ['localhost'] };
}

🔧 Advanced Usage

Conditional Loading

// Only load on specific pages
if (window.location.pathname.includes('/premium-content/')) {
  window.AdGateConfig = { sensitivity: 'high' };
  
  const script = document.createElement('script');
  script.src = 'https://unpkg.com/adgate/js/lib.js';
  document.head.appendChild(script);
}

Custom Event Handling

// Listen for detection events
document.addEventListener('adblock-status', function(e) {
  if (e.detail.detected) {
    console.log('Adblock detected via:', e.detail.method);
    // Your custom logic here
  }
});

🛡 Best Practices

Performance

  • Load AdGate after critical content
  • Use appropriate sensitivity levels
  • Consider user experience impact

User Experience

  • Provide clear instructions
  • Offer alternative access methods
  • Respect user privacy choices

Development

  • Test across different browsers
  • Use whitelist in development
  • Monitor false positive rates

Legal Compliance

  • Inform users about ad requirements
  • Provide opt-out mechanisms where required
  • Follow local privacy regulations

🤝 Contributing

PRs welcome! Please test thoroughly across browsers before submitting.

Development Setup

git clone https://github.com/kikkopy/adgate.git
cd adgate
npm install
npm test

📜 License

MIT License. Free for personal and commercial use.


Created by kikkopy