Every HTML5 game uploaded to EEND Games (from Godot, Unity WebGL, Phaser, Construct, or custom Canvas engines) is automatically connected to the EEND Ads Bridge. Call window.adBreak() or window.EENDGames.showRewarded() to show non-intrusive commercial breaks and rewarded perk bonuses.
1. The game posts an EEND_AD_REQUEST event to the parent page.
2. Parent page displays the high-converting modal and mutes game audio.
3. On completion, parent returns EEND_AD_RESPONSE with status: 'rewarded'.
Export your game to HTML5 from Godot, Unity, Phaser, or any engine. Zip your build folder and upload it in the admin portal.
When players launch your game via /api/games/hosted/[slug], our proxy automatically injects <script src="/api/games/ads-bridge.js"> before </head>.
Your game can call standard Google H5 adBreak() or EENDGames.showRewarded(). Everything works automatically without boilerplate.
To serve official Google AdSense H5 video ads, commercial breaks, and banner units across your games, follow this setup:
Copy your Publisher ID (starts with ca-pub-) into your .env.local file:
NEXT_PUBLIC_ADSENSE_CLIENT_ID=ca-pub-XXXXXXXXXXXXXXXX
While developing locally or before going live, Google provides data-adbreak-test="on" which is automatically set in dev mode. This lets you test video ad breaks without violating Google policies.
Google requires data-ad-frequency-hint="30s"on the script tag (already configured in our root layout). Commercial breaks are automatically throttled so players aren't spammed with ads.
Save as AdsManager.gd and add as an Autoload in Project Settings â Globals â Autoload.
# ==============================================================================
# AdsManager.gd (Godot 4 & Godot 3 Autoload Singleton)
# Works out of the box when your game is uploaded to EEND Games.
# The EEND Ads Bridge is auto-injected into your hosted index.html!
# ==============================================================================
extends Node
signal reward_granted(reward_name)
signal ad_completed()
signal ad_dismissed()
func _ready():
process_mode = Node.PROCESS_MODE_ALWAYS
print("[AdsManager] Ready on EEND Games Portal")
# 1. Show Commercial Break / Interstitial Ad
func show_interstitial(ad_name: String = "game_break") -> void:
if not OS.has_feature("web"):
print("[AdsManager] Non-web platform: skipping interstitial.")
emit_signal("ad_completed")
return
mute_audio(true)
# Godot 4.x uses JavaScriptBridge; Godot 3.x uses JavaScript
var js_code = """
if (window.adBreak) {
window.adBreak({
type: 'start',
name: '%s',
beforeAd: () => {},
afterAd: () => { window.__godot_ad_done && window.__godot_ad_done(); }
});
} else if (window.EENDGames) {
window.EENDGames.showInterstitial({ name: '%s' });
}
""" % [ad_name, ad_name]
_eval_js(js_code)
mute_audio(false)
emit_signal("ad_completed")
# 2. Show Rewarded Ad (Revive player, double coins, unlock skins)
func show_rewarded(reward_name: String = "+100 Coins", callback: Callable = Callable()) -> void:
if not OS.has_feature("web"):
print("[AdsManager] Non-web platform: granting test reward.")
if callback.is_valid():
callback.call(true)
emit_signal("reward_granted", reward_name)
return
mute_audio(true)
# Execute rewarded call with Google adBreak / EEND SDK
var js_code = """
if (window.EENDGames) {
window.EENDGames.showRewarded({
name: 'reward_ad',
rewardLabel: '%s',
onReward: () => {
console.log('[Godot] Rewarded perk granted: %s');
}
});
}
""" % [reward_name, reward_name]
_eval_js(js_code)
mute_audio(false)
func mute_audio(is_muted: bool) -> void:
# Mute Master Audio bus during commercial breaks
var master_bus = AudioServer.get_bus_index("Master")
if master_bus >= 0:
AudioServer.set_bus_mute(master_bus, is_muted)
func _eval_js(code: String):
# Safe cross-version web bridge
if ClassDB.class_exists("JavaScriptBridge"):
# Godot 4
return JavaScriptBridge.eval(code)
elif ClassDB.class_exists("JavaScript"):
# Godot 3
return ClassDB.instantiate("JavaScript").eval(code)
| Function | Parameters | Description |
|---|---|---|
window.adBreak(params) | { type: 'start'|'reward', name, beforeAd, afterAd, ... } | Standard Google H5 Games Ad Placement API method. Supported universally. |
window.EENDGames.showInterstitial(opts) | { name, beforeAd, afterAd, adBreakDone } | Shows commercial break. Returns Promise<boolean> that resolves true once viewed. |
window.EENDGames.showRewarded(opts) | { name, rewardLabel, onReward, onDismiss, ... } | Shows rewarded video ad. Calls onReward() only if the player completes the ad without forfeiting. |
window.EENDGames.requestReward(label) | label: string (e.g. "+100 Gold") | Async helper. Returns await EENDGames.requestReward(...) resolving true if reward granted. |
window.addEventListener('eend:pause', fn) | CustomEvent('eend:pause') | Fired right before any ad modal opens. Use to mute Web Audio contexts and pause high-rate game loops. |
window.addEventListener('eend:resume', fn) | CustomEvent('eend:resume') | Fired immediately when the ad modal closes. Use to resume audio and gameplay loops. |
You can download the standalone bridge script or link directly to /js/eend-game-ads.js during local testing. When running standalone without an iframe parent, the bridge automatically opens interactive simulation dialogs so you can verify your game logic offline!