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

@adview/react-popunder

v1.0.1

Published

React wrapper component for AdView PopUnder script

Readme

@adview/react-popunder

React wrapper component for the AdView PopUnder script. This package provides a convenient way to integrate popunder advertisements into React applications.

Installation

npm install @adview/react-popunder
# or
yarn add @adview/react-popunder

Features

  • React Component: Easy integration with React applications
  • TypeScript Support: Full type safety with TypeScript definitions
  • Custom Hook: Programmatic control with usePopunder hook
  • Automatic Cleanup: Proper script cleanup on component unmount
  • Performance: Prevents duplicate script loading
  • Error Handling: Built-in error handling and loading states

Usage

Basic Component Usage

import React from 'react';
import Popunder from '@adview/react-popunder';

function App() {
  return (
    <div>
      <h1>My Website</h1>
      <a href="https://example.com">Click me</a>

      <Popunder
        unitid="123456"
        every="1h"
        target="h1"
        template="https://localhost:6666/{unitid}/path"
      />
    </div>
  );
}

Hook Usage

import React from 'react';
import Popunder, { usePopunder } from '@adview/react-popunder';

function HookExample() {
  const popunder = usePopunder({
    unitid: '123456',
    every: '1h',
    target: 'h1',
    template: 'https://localhost:6666/{unitid}/path',
    everyDirect: 3,
  });

  // Hook returns PopUnder instance when ready (client-side only)
  if (popunder) {
    console.log('PopUnder instance is ready');
  }

  return <div>My Component</div>;
}

Advanced Component Usage

import React from 'react';
import Popunder from '@adview/react-popunder';

function AdvancedApp() {
  return (
    <div>
      <Popunder
        unitid="gaming_banner_001"
        template="https://ads.example.com/{unitid}/click"
        target="a, .btn, .clickable"
        every="2h30m"
        everyDirect={5}
        ignoreFilter={['.no-popup', '#header']}
        categories="gaming,entertainment"
        cookieName="gaming_popunder"
        cookieDomain=".gaming-site.com"
        mode="production"
        params={['source_react', 'campaign_123', 'affiliate_code']}
      />
    </div>
  );
}

Conditional Loading

import React, { useState } from 'react';
import Popunder from '@adview/react-popunder';

function ConditionalApp() {
  const [enableAds, setEnableAds] = useState(true);
  const [userConsent, setUserConsent] = useState(false);

  return (
    <div>
      <button onClick={() => setUserConsent(!userConsent)}>
        {userConsent ? 'Revoke' : 'Give'} Consent
      </button>

      <button onClick={() => setEnableAds(!enableAds)}>
        {enableAds ? 'Disable' : 'Enable'} Ads
      </button>

      {enableAds && userConsent && (
        <Popunder
          unitid="conditional_001"
          template="https://ads.example.com/{unitid}"
          target="a"
        />
      )}
    </div>
  );
}

API Reference

Popunder Component Props

All props from PopunderProps interface can be passed directly to the component:

| Prop | Type | Description | |------|------|-------------| | unitid | string | Ad unit identifier | | template | string | URL template for the popunder | | target | string | CSS selectors for clickable elements | | every | string | Time between popunders (e.g., "1h30m", "2h") | | everyDirect | number | Show popunder after N direct clicks | | ignoreFilter | string[] | Array of CSS selectors to ignore | | categories | string | Custom categories | | cookieName | string | Custom cookie name | | cookieDomain | string | Cookie domain | | mode | string | Operating mode | | params | string[] | Array of custom parameters |

PopunderProps Interface

interface PopunderProps {
  [key: string]: any;
  cookieName?: string;
  cookieDomain?: string;
  every?: string;
  everyDirect?: number;
  ignoreFilter?: string[];
  target?: string;
  categories?: string;
  template?: string;
  unitid?: string;
  mode?: string;
  params?: string[];
}

usePopunder Hook

function usePopunder(config: PopunderProps): PopUnder | null

The hook accepts a configuration object and returns:

  • PopUnder instance when ready (client-side)
  • null during SSR or before initialization

Hook Features

  • SSR-safe: Returns null on server-side
  • Automatic initialization when window is available
  • Memoized instance creation
  • Works with Next.js and other SSR frameworks

TypeScript Support

This package includes full TypeScript definitions. Import types as needed:

import Popunder, { PopunderProps } from '@adview/react-popunder';

Examples

Basic Implementation

import Popunder from '@adview/react-popunder';

<Popunder
  unitid="123456"
  every="1h"
  target="h1"
  template="https://localhost:6666/{unitid}/path"
/>

Hook Implementation

import { usePopunder } from '@adview/react-popunder';

const popunder = usePopunder({
  unitid: '123456',
  every: '1h',
  target: 'h1',
  template: 'https://localhost:6666/{unitid}/path',
  everyDirect: 3,
});

With Multiple Parameters

<Popunder
  unitid="advanced_001"
  template="https://ads.example.com/{unitid}/redirect"
  target="a, button"
  every="2h"
  everyDirect={3}
  categories="sports,news"
  params={['ref_source', 'campaign_id', 'user_segment']}
/>

Best Practices

  1. Single Instance: Only use one Popunder component per page
  2. Conditional Rendering: Use conditional rendering for user consent
  3. SSR Compatibility: Use the hook for SSR frameworks like Next.js
  4. Performance: Component automatically prevents duplicate script loading
  5. Cleanup: Component handles cleanup automatically on unmount

Troubleshooting

Script Not Loading

  • Check browser console for errors
  • Verify the template URL is accessible
  • Ensure required props (unitid, template) are provided

Popunder Not Showing

  • Check browser popup blocker settings
  • Verify target elements exist on the page
  • Check frequency settings (every, everyDirect)

Next.js SSR Issues

  • Use the usePopunder hook for SSR compatibility
  • Hook automatically handles window availability

TypeScript Errors

  • Ensure you have @types/react installed
  • Check that props match PopunderProps interface

License

MIT