React SDK

Rewarded ads with useEzoicRewarded

useEzoicRewarded() wraps window.ezRewardedAds with promise-based methods instead of raw callbacks, so a "watch a video for a reward" button is a normal async function.

What this demonstrates

The hook exposes request, show, requestAndShow, requestWithOverlay, and contentLocker, each resolving with a typed outcome object (status, reward, msg). On an Ezoic JS-integrated page no loader URL is required: the default mode calls ezstandalone.initRewardedAds(placements?) and the Ezoic runtime serves the host-correct /porpoiseant/ezadloadrewarded.js loader itself. Pass useEzoicRewarded({ loaderUrl }) only as an escape hatch for pages that are not Ezoic JS-integrated.

View source on GitHub →

SDK docs: README — Rewarded ads

Hook usage
import { useEzoicRewarded } from '@ezoic/react-sdk';

function RewardButton() {
  // No loaderUrl on an Ezoic JS-integrated page — the runtime serves the loader.
  // Optionally scope the site-wide placements the runtime enables.
  const { requestAndShow } = useEzoicRewarded({
    placements: { anchor: false, interstitial: false, video: true, sideRails: false },
  });

  async function onClick() {
    const { reward } = await requestAndShow();
    if (reward) {
      // unlock the reward
    }
  }

  return <button onClick={onClick}>Watch ad for reward</button>;
}

Live demo

The panel below embeds the SDK's own demo app (built from @ezoic/react-sdk v1.0.0) — use its "Rewarded ads" panel. No loader URL is needed; the demo runs the default (runtime-served) mode, and the Ezoic runtime serves the rewarded loader on an integrated page. Open the full demo in a new tab →