/jeux:web-game-ad-monetization-implementationfrom jeux
Use when actually building or fixing ad code in a web game — choosing placements, writing SDK calls, handling pause/resume, no-fill, errors and reward validation, or debugging ads that fire at the wrong moment. Covers CrazyGames, Poki, Yandex Games and Google H5. For judging whether an offer is fair rather than how to wire it, use f2p-monetization-ethics-review instead.
Ships in jeux. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill when a web game needs ad monetization implementation or QA, especially:
Do not irritate the player. Earn by placing ads where they feel natural, optional, and fairly rewarded.
Never add ads before understanding the core loop. Ads must be based on gameplay rhythm, player intent, and the economy, not on random timers alone.
Before implementing platform-specific ad calls, check the official documentation for the target platform.
The platform sections below were verified on 2026-08-02 against:
adBreak()Re-read them before submission. If official docs conflict with this skill, official docs win.
reference/ad-manager/ next to this file is a tested implementation of every contract below: placement gating, the pause/resume lifecycle, reward validation, and adapters for all four platforms. 31 tests, no dependencies, npm test.
Read it before writing your own — or copy it and adapt. When this skill and that code disagree, the code has tests and this file does not.
Run before this skill when possible:
experience-engineering-review to understand the core loop and emotional rhythm.virtual-economy-review if rewards/currency/upgrades exist.f2p-monetization-ethics-review to check value exchange and player trust.Run after this skill when possible:
analytics-retention-instrumentation to validate funnels.portal-publish-readiness or platform-specific publish readiness.Describe the loop in this format:
Player action -> risk/challenge -> result -> reward -> upgrade/unlock -> next attempt
Find moments where player control is already paused or the player expects a transition:
Never treat active gameplay as a break.
For every possible ad placement, label the player state:
Ads are safest when the player is victorious, planning, or already in a menu.
Ads are riskiest when the player is focused, frustrated, in tutorial, or about to act.
Map the economy:
Rewarded ads should speed up progress, not replace the game.
Output:
| Placement | Ad type | Player state | Trigger | Reward/value | Risk | Decision |
|---|---|---|---|---|---|---|
Only implement placements marked as low or medium irritation risk.
Do not hardcode ad logic directly inside screens, buttons, or level scripts.
Create an ad placement configuration layer. Example structure:
type AdPlacementConfig = {
id: string;
type: "interstitial" | "rewarded";
naturalBreakRequired: boolean;
minActiveGameplaySeconds?: number;
cooldownSeconds?: number;
everyNthOpportunity?: number;
maxOffersPerSession?: number;
suppressDuringTutorial?: boolean;
suppressAfterRepeatedDeaths?: boolean;
rewardId?: string;
};
const adPlacements: Record<string, AdPlacementConfig> = {
levelCompleteInterstitial: {
id: "level_complete_interstitial",
type: "interstitial",
naturalBreakRequired: true,
minActiveGameplaySeconds: 90,
cooldownSeconds: 120,
everyNthOpportunity: 3,
suppressDuringTutorial: true
},
reviveRewarded: {
id: "revive_rewarded",
type: "rewarded",
naturalBreakRequired: true,
maxOffersPerSession: 3,
suppressDuringTutorial: true,
suppressAfterRepeatedDeaths: true,
rewardId: "revive_50_hp"
}
};
The exact code style may vary by engine, but the principle must remain: placements are named, configurable, testable, and not scattered.
Prefer a provider interface so the game is not tightly coupled to one portal SDK.
Example:
type AdResult =
| { status: "shown" }
| { status: "no_fill" }
| { status: "error"; error?: unknown };
type RewardedAdResult =
| { status: "rewarded" }
| { status: "closed" }
| { status: "no_fill" }
| { status: "error"; error?: unknown };
interface AdProvider {
showInterstitial(placementId: string): Promise<AdResult>;
showRewarded(placementId: string): Promise<RewardedAdResult>;
isRewardedAvailable?(placementId: string): Promise<boolean>;
}
Recommended providers:
CrazyGamesAdProviderPokiAdProviderYandexAdProviderGoogleH5AdProviderGameDistributionAdProviderMockAdProvider for local development and testsInterstitial ads are non-rewarded fullscreen ads. They are allowed only at natural breaks.
The player should feel:
The round ended. A short ad break happened. Now I continue.
The player should never feel:
The game stole control from me.
Prefer:
Use with caution:
Avoid:
First, determine who paces the ads. This is the single most misunderstood part of web game ad integration.
All four major portals pace interstitials themselves. CrazyGames, Poki, Yandex Games and Google H5 all throttle server-side and explicitly want a request at every valid opportunity:
adCooldown).commercialBreak() will trigger an ad; Poki's system will determine when a user is ready, so you can signal as many commercial break opportunities as possible." A rewardedBreak() resets the commercial timer.frequencyCapped in breakStatus.On these platforms, adding your own cooldown on top only loses revenue. Withholding a request does not improve the player experience — the SDK would have declined it anyway, silently and for free.
So split your rules in two:
Player-protection gates — always yours, never delegated:
Revenue-pacing knobs — delegate when the platform paces:
If you ship on a platform that does not pace for you, or you use a direct ad network, apply these defaults yourself:
Encode this distinction in code rather than in comments. In reference/ad-manager/, providers expose platformControlsInterstitialPacing, and the manager skips only the revenue knobs when it is true — the protection gates always run.
Before showing:
adShowing = trueinterstitial_opportunityDuring ad:
After close, finish, error, or no-fill:
adShowing = falseIF current moment is active gameplay
THEN do not show interstitial
IF tutorial is incomplete
THEN do not show interstitial unless platform requires startup ads
IF player has not completed at least one meaningful gameplay segment
THEN do not show interstitial
IF cooldown is active
THEN do not show interstitial
IF player is in high frustration state
THEN skip or delay interstitial
IF moment is level complete, game over, retry, next level, or menu transition
THEN interstitial may be valid
Always resume game flow on ad error or no fill.
Rewarded ads are optional ads that give a clear benefit after successful completion.
The player should feel:
I chose this because the reward helps me right now.
The player should never feel:
The game forced me to watch an ad to progress.
Rewarded ads must be:
The non-ad option must be visible immediately. Do not hide it behind timers, tiny text, low contrast, or confusing wording.
Prefer:
Use with caution:
Avoid:
Use ethical motivation, not dark patterns.
Good psychological fit:
Bad psychological fit:
Reward copy must state:
Good copy:
Bad copy:
Player-initiated ad shops can have more frequent rewarded opportunities, but each click must still be explicit and honest.
Before showing the offer:
rewarded_ad_offerBefore launching the ad:
pendingRewardrewarded_ad_acceptOn success/rewarded/finished callback:
pendingRewardrewarded_ad_complete and reward_grantedOn close without reward, error, blocked ad, or no-fill:
rewarded_ad_closed, rewarded_ad_error, or rewarded_ad_no_fillNever grant a reward in a generic closed callback unless the platform explicitly says that callback means reward earned.
Minimum events:
ad_placement_opportunityinterstitial_opportunityinterstitial_startinterstitial_completeinterstitial_errorinterstitial_no_fillrewarded_ad_offerrewarded_ad_acceptrewarded_ad_declinerewarded_ad_startrewarded_ad_completerewarded_ad_closedrewarded_ad_errorrewarded_ad_no_fillreward_grantedreward_blockedcontinue_without_adchurn_after_ad_offer, derived from session behaviorchurn_after_interstitial, derived from session behaviorRecommended properties:
placement_idad_typescreenlevelrun_idsession_timeactive_gameplay_timereward_idreward_amountproviderplatformgame_versiondevice_typeplayer_statecooldown_remainingreason_skippedCritical distinction:
ad offer != ad start != ad completion != reward granted
Do not merge these events.
Before implementation, detect the target platform and use its official SDK behavior.
Getting this table wrong is the most expensive bug in ad integration: it either grants rewards for ads nobody watched, or silently withholds rewards people earned.
| Platform | Grant the reward on | Dismissal arrives as | Never grant on |
|---|---|---|---|
| CrazyGames | adFinished | adError — there is no separate close callback | any adError |
| Poki | rewardedBreak() resolves true | resolves false | false, rejection |
| Yandex Games | onRewarded | onClose(wasShown) with no prior onRewarded | onClose alone, onError |
| Google H5 | adViewed, or breakStatus: "viewed" | adDismissed, breakStatus: "dismissed" | adBreakDone alone |
window.CrazyGames.SDK.ad.requestAd("midgame", { // or "rewarded"
adStarted: () => { pauseGame(); muteAudio(); },
adFinished: () => { resumeGame(); unmuteAudio(); /* rewarded: grant here */ },
adError: (e) => { resumeGame(); unmuteAudio(); /* never grant */ },
});
Platform-specific rules that will get a build rejected:
adError. Code that rewards on "not an error" rewards on dismissal.unfilled, adblock, adCooldown, adsDisabledBasicLaunch, other.adStarted), not when it is requested — a request may return nothing, and muting music with no visible change confuses players.adFinished or adError. A request is not instantaneous; auctions take time.await PokiSDK.init();
PokiSDK.gameLoadingFinished();
// Bracket every gameplay segment:
PokiSDK.gameplayStart();
PokiSDK.gameplayStop();
// Non-rewarded break. The callback fires only if an ad will actually show.
PokiSDK.commercialBreak(() => pauseAndMute())
.then(() => { resumeGame(); });
// Rewarded. `withReward` is the only reward signal.
PokiSDK.rewardedBreak(() => pauseAndMute())
.then((withReward) => {
if (withReward) grantReward();
else continueWithoutReward();
});
Platform-specific notes:
gameplayStart() / gameplayStop() must wrap gameplay segments. Poki uses them for pacing and load-to-play measurement, so wrong bracketing degrades ad timing.gameplayStop() / gameplayStart().ysdk.adv.showFullscreenAdv({
callbacks: {
onOpen: () => pauseAndMute(),
onClose: (wasShown) => { resumeGame(); /* wasShown === false means nothing played */ },
onError: (e) => resumeGame(),
},
});
ysdk.adv.showRewardedVideo({
callbacks: {
onOpen: () => pauseAndMute(),
onRewarded: () => grantReward(), // the ONLY reward signal
onClose: (wasShown) => resumeGame(),
onError: (e) => resumeGame(),
},
});
Platform-specific notes:
onClose fires on close, on error, and when the ad failed to open because it was called too frequently. wasShown is how you tell a real impression from a no-op.setInterval(() => ysdk.adv.showFullscreenAdv(), 180000) as the canonical wrong implementation. Never fire on a timer during play.adConfig({ preloadAdBreaks: "on" }); // without this the first break will not fill
adBreak({
type: "next", // preroll | start | pause | next | browse | reward
name: "level_complete",
beforeAd: () => pauseAndMute(), // must be synchronous
afterAd: () => resumeGame(),
adBreakDone: (info) => log(info.breakStatus),
});
adBreak({
type: "reward",
name: "revive",
beforeReward: (showAdFn) => showOfferUi(showAdFn), // fires only if an ad exists
adViewed: () => grantReward(), // the reward signal
adDismissed: () => continueWithoutReward(),
adBreakDone: (info) => log(info.breakStatus),
});
Platform-specific notes:
adBreakDone is the only callback guaranteed to fire. Settle your promise there or you will hang forever when no ad is preloaded.breakStatus values: notReady, timeout, invalid, error, noAdPreloaded, frequencyCapped, ignored, other, dismissed, viewed.ignored means the player never clicked your reward prompt before the next break — a UI problem, not an ad problem.beforeAd must be synchronous; the ad displays immediately after it returns.adBreakDone runs after afterAd, so it fires after your game has already resumed. If work must happen before resume, move it out of afterAd.preroll placement per page load; later ones fail with invalid.When asked to analyze or implement ads, produce this output:
# Web Game Ad Monetization Implementation
## Core Loop Analysis
Player action -> risk/challenge -> result -> reward -> upgrade/unlock -> next attempt
## Player-State Map
| Moment | Player state | Ad risk | Note |
|---|---|---|---|
## Economy Impact
- Currency sources:
- Currency sinks:
- Reward inflation risk:
- Non-ad path quality:
## Interstitial Plan
### Accepted placements
-
### Rejected placements
-
### Cooldowns / frequency caps
-
### Platform-specific notes
-
## Rewarded Plan
### Accepted offers
-
### Rejected offers
-
### Reward amounts
-
### No-fill fallback
-
### Platform-specific notes
-
## Implementation Changes
- Files to change:
- Ad provider/adapter:
- Placement config:
- UI states:
- Analytics:
- Save/pause/resume:
## Risk Checklist
-
## QA Matrix
-
## Test Plan
-
Do not implement ad calls before providing the placement rationale.
A complete pass, so the expected depth is unambiguous. Match this level of specificity.
Brief: Rooftop Dash — endless runner, one-touch jump, coins during the run, upgrade shop between runs (magnet, shield, coin multiplier). Average run 35 seconds; runs 1–3 are shorter, ~15 seconds. Target platform CrazyGames, desktop and mobile.
tap to jump -> dodge obstacles / collect coins -> crash -> see score + coins ->
spend coins on upgrades -> longer run next time
Loop length is the dominant constraint: at 35 seconds per run, "an ad after every game over" means an ad every 40 seconds. That is unshippable regardless of what the SDK permits.
| Moment | Player state | Ad risk | Note |
|---|---|---|---|
| Mid-run | focused | Fatal | One-touch game; any overlay is a lost run and a rage quit |
| Crash, score counting up | curious | High | Player is watching their number. Do not interrupt the count |
| Score settled, coins granted | recovering | Low | The safe window. Result seen, reward banked |
| Shop open | planning | Low | Player chose to be here, tolerant of an offer |
| Tap to retry | impatient | High | Player has already committed to the next run |
| Runs 1–3 | learning | Fatal | No ads at all before the game is understood |
Accepted:
game_over_interstitial — after score settles and coins are banked, before the retry screen becomes interactive. Gated on activeGameplaySeconds >= 120 and not frustratedRejected:
Cooldowns / frequency caps: none of our own. CrazyGames paces midgame ads at ~1 per 3 minutes and ignores early requests. We request at every qualifying game over and let the SDK decide.
Platform-specific notes: request via requestAd("midgame", ...). Pause on adStarted, resume on both adFinished and adError. Because we also offer a revive rewarded ad on the game-over screen, we must not do both for the same death — CrazyGames forbids combining a midgame ad with a "keep playing" rewarded offer at the same transition. Resolution: if the revive offer is shown and declined, skip the interstitial for that death.
Accepted:
| Offer | Trigger | Reward | Why it works |
|---|---|---|---|
revive_rewarded | After a crash on a run above the player's median distance | Continue from crash point | Loss aversion is real but the loss is real too — the player earned that distance |
double_coins_rewarded | After coin count finishes animating | 2× this run's coins | Player sees the exact number being doubled |
ad_shop_rewarded | Player opens the shop and taps "Free coins" | 100 coins | Fully player-initiated |
Rejected:
Reward amounts: revive is free distance, no coins, so it cannot inflate the economy. Double-coins capped at 8 per session; at ~40 coins/run that is at most 320 bonus coins, under one upgrade tier. Ad shop capped at 12.
No-fill fallback: "No ad available right now — here are 20 coins instead." Small, once per session, so a no-fill is not experienced as punishment.
Platform-specific notes: reward on adFinished only. A dismissed rewarded ad on CrazyGames arrives as adError, so a "grant unless error" implementation would grant on dismissal.
src/game/GameOverScreen.ts, src/game/Shop.ts, src/main.tsCrazyGamesAdProvider from reference/ad-manager/placements.tsAdHooks wired to the existing pause system; verify visibilitychange does not double-resume| Scenario | Expected |
|---|---|
| Crash during run 1 | No ad of any kind |
| Crash at 130s active play | Interstitial requested; SDK may decline |
| Two crashes 30s apart | Second request ignored by SDK; game continues without stutter |
| Revive offered, declined | No interstitial for that death; restart immediately |
| Revive accepted, ad completes | Player continues from crash point |
| Revive accepted, player closes ad early | No revive, clear message, restart |
| Revive accepted, no fill | No revive, 20-coin consolation, restart |
| Adblock enabled | Game fully playable; rewarded buttons hidden, not dead |
| Tab hidden mid-ad, returned | Audio restored once, game resumes once, no double reward |
| Double-tap the revive button | One ad request, one reward |
Reject or redesign the request if it asks to:
When rejecting, propose a compliant alternative.
Before finishing implementation, verify:
If any item fails, do not ship.
Read these alongside this skill:
LICENSE (opens in a new tab)SOURCE.md (opens in a new tab)reference/ad-manager/README.md (opens in a new tab)reference/ad-manager/package.json (opens in a new tab)reference/ad-manager/src/ad-manager.ts (opens in a new tab)reference/ad-manager/src/index.ts (opens in a new tab)reference/ad-manager/src/placements.ts (opens in a new tab)reference/ad-manager/src/providers/crazygames.ts (opens in a new tab)reference/ad-manager/src/providers/google-h5.ts (opens in a new tab)reference/ad-manager/src/providers/mock.ts (opens in a new tab)reference/ad-manager/src/providers/poki.ts (opens in a new tab)reference/ad-manager/src/providers/yandex.ts (opens in a new tab)reference/ad-manager/src/types.ts (opens in a new tab)reference/ad-manager/test/ad-manager.test.ts (opens in a new tab)references/ad-analytics-events.md (opens in a new tab)references/ad-placement-config.md (opens in a new tab)references/ad-provider-abstraction.md (opens in a new tab)references/ad-qa-matrix.md (opens in a new tab)references/platform-docs-reminder.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub antoninmrtl/claude-kit --plugin jeux17 skills in this plugin
/audio-designEngine-neutral game audio technique: bus layout, volume sliders in decibels, loudness, ducking music under dialogue, adaptive music and SFX variation, with Godot, Unity and FMOD/Wwise mappings. Use when mixing a game, making music react to combat, fixing repetitive footsteps or beat sync, or a mix that clips or pumps. Not for the Godot audio API (`godot-audio`).
/codixelChanges how pixel art is made with AI. Instead of drawing from imagination, ask the user for a reference image, pixelate it, rig it, animate it, and check every step with the user. Use whenever the user asks for pixel art of any kind (sprites, characters, creatures, effects, scenes, props, tiles, gems)./designing-mini-gamesDesigns original, compact mini-games — rules, controls, scoring, hazards, and difficulty curves — for any input scheme, including one-button (tap / hold / release) games. Use when defining a new mini-game concept, converting creative constraints or seeds into mechanics, choosing an input scheme, checking state-variable necessity, or preventing idle, hold-only, or mashing play from becoming optimal./evaluating-gameplay-balanceEvaluates and improves gameplay balance from telemetry in any engine. Use when comparing monotonous vs exploratory play, diagnosing death/spawn/scoring/input issues, setting difficulty, timer, or pacing targets with human-limited simulated players, calibrating those players against a person's replays or run summaries across play sessions, checking games whose purchases, upgrades, or loadouts accumulate, or proposing structural balance fixes instead of numeric tuning./exploring-game-design-spaceExplores a broad game-design space by generating structurally varied concepts, attacking obvious failures, mutating promising mechanisms, and returning a small set of distinct testable hypotheses without ranking speculative fun. Use for open-ended game ideation, mechanic-space exploration, game-jam concept search, or deriving multiple mechanical directions from a seed. Do not use merely to audit one existing concept or to choose among a supplied shortlist./game-feelAdds engine-neutral juice to a working mechanic: trauma-based screen shake, hit-stop, eased tweens, squash and stretch, and knockback. Use when the game feels flat, weightless or not punchy, or hits and jumps should feel satisfying. Not for coyote time (`platformer`), input buffering (`input-systems`), camera follow (`camera-systems`) or HUD layout (`game-ui-ux`).