Drop-in SDKs for Unity, Construct 2, Construct 3, and plain JavaScript. Midroll and rewarded ads - one integration, every popular game platform.
The WGSDK communicates between your Unity game and the browser. The package ships with ExampleScene.unity and MyGame.cs as references — drop them once you have your own integration working.
Before anything else, make sure the WGPlayer Universal Tag is in your game's index.html inside the <head> section.
<!-- WG Universal Tag --> <script type="text/javascript" async> !function(e,t){ a=e.createElement("script"), m=e.getElementsByTagName("script")[0], a.async=1, a.src=t, m.parentNode.insertBefore(a,m) }(document, "https://universal.wgplayer.com/tag/?lh=" + location.hostname + "&wp=" + location.pathname + "&ws=" + location.search); </script>
Download the SDK and add it to Unity. The package contains example scenes and scripts.
To avoid ReferenceError: window is not defined, go to the Advanced section of project properties and set Use worker to No.
The archive contains a Unity package file. Import its contents into your game project.

From the Project panel, drag the WGSDK Prefab to your Hierarchy panel.

Update the WGSDK default values to fit your needs. If you're unsure, the defaults are safe.

In the image above, look at the Wee Goo Ad Manager (script) panel. Two options control behavior: Ad Interval and Show Ad Every N Events.
Ad Interval — when greater than 0, the Ads Manager automatically calls a midroll every N seconds. Useful for slower-paced games (e.g. chess) where setting this to 240 shows an ad every 4 minutes.
Show Ad Every N Events — postpones the ad display. Imagine a game with very short levels where the user restarts every 30 seconds: showing an ad every 30 seconds is awful UX, so this lets you show it once every N restarts (set to 2 to show every other call).
Create a button and bind its click event to the WGSDK Prefab. This lets you call the GetAd function from a button click.

Now you can use the WeeGooAdManager to display midroll ads from a button click.
Select the button in the Hierarchy panel and look at the Inspector panel — find the On Click area. Click the lower-right plus (+) sign to add a new action. Drag the WeeGooAdManager object from the Hierarchy panel into the On Click — None (object) field in the Inspector panel.

Click the No function dropdown, hover WeeGooAdManager, and click GetAd. In a real game, this could fire every Nth time a user clicks the next-level button.
The ad will only display in a live environment with a valid WGPlayer AFG implementation. To confirm the component is integrated, check the developer console in your browser.
If you need to call the ad from an existing script, update it as shown below.

If Get Ad Every N Event is set to its default (5), the function PlayerHasDied needs to be called 5 times before an ad displays.
Whether you trigger the ad from a button or a script, the component automatically pauses and resumes the game based on the ad state.
In newer versions of Unity the JavaScript initialization sequence in index.html has changed. Make sure you assign unityInstance to gameInstance:
// ... var gameInstance; // Define the gameInstance variable here script.onload = () => { createUnityInstance(canvas, config, (progress) => { spinner.style.display = "none"; progressBarEmpty.style.display = ""; progressBarFull.style.width = `${100 * progress}%`; }).then((unityInstance) => { gameInstance = unityInstance; // make sure to have this assignment loadingCover.style.display = "none"; if (canFullscreen) { if (!hideFullScreenButton) { fullscreenButton.style.display = ""; } fullscreenButton.onclick = () => { unityInstance.SetFullscreen(1); }; } }).catch((message) => { alert(message); }); }; // ...
Rewarded ads give the user a prize in exchange for watching. Three events fire: onReady, onComplete, onFail. Wire callbacks to each.
From the Project panel, drag the RewardControl Prefab into your scene. The prefab is a demo — replace it with your own game logic when you're ready.

Focus the WeeGooAdManager Prefab and subscribe to reward events in the Inspector panel:
The reward call-to-action element should only be visible after OnReady fires. Hide it after each Success or Fail — it'll re-appear when OnReady fires again.

See MyGame.cs and ExampleScene in the package for full details.
While testing and debugging, we use a special test ad unit that returns test ads for every request.
Before publishing your game, contact us with your developer endpoint (site or name) so we can manually enable production rewarded ads.
Back to platformsA drop-in plugin for the Construct 2 editor. Once installed, ads become event-sheet conditions and actions just like any other plugin.
Make sure the WGPlayer Universal Tag is in your game's index.html inside the <head> section.
<!-- WG Universal Tag --> <script type="text/javascript" async> !function(e,t){ a=e.createElement("script"), m=e.getElementsByTagName("script")[0], a.async=1, a.src=t, m.parentNode.insertBefore(a,m) }(document, "https://universal.wgplayer.com/tag/?lh=" + location.hostname + "&wp=" + location.pathname + "&ws=" + location.search); </script>
Download the SDK and extract the folder from the archive to C:\Program Files\Construct 2\exporters\html5\plugins.
Right-click on Object types and select Insert new object, then double-click on WeeGoo SDK from the Monetisation category.

Follow the information in the image below and apply appropriate settings to your game logic.


The WGSDK is loaded — you can safely init a reward or request a midroll. Use the Init rewarded ad action.
The ad is now visible. Pause/mute your game to avoid bad UX and stay compliant with ad policy.
The ad finished — resume/unmute your game.
A reward ad is queued. Show the call-to-action whenever you decide.
The user watched the entire ad and should receive the reward.
The user didn't watch enough — the reward should not be granted.
The user closed the reward advertisement — resume/unmute the game.

Show a midroll ad.
Request a reward ad and queue it for later. When ready, the When reward ad is available condition fires.
Use this when the user clicks the reward ad call-to-action in your game.
While testing, we use a special test ad unit that returns test ads for every request.
Before publishing your game, contact us with your developer endpoint (site or name) so we can enable production rewarded ads.
When exporting, make sure compression is not set to advanced — that breaks the build.
You can download a demo project to see how actions and conditions are wired up.
Back to platforms
A modern add-on for Construct 3. Install via the Addon Manager, then drop the WeeGooSDK object into your scene and wire up events.
Make sure the WGPlayer Universal Tag is in your game's index.html inside the <head> section.
<!-- WG Universal Tag --> <script type="text/javascript" async> !function(e,t){ a=e.createElement("script"), m=e.getElementsByTagName("script")[0], a.async=1, a.src=t, m.parentNode.insertBefore(a,m) }(document, "https://universal.wgplayer.com/tag/?lh=" + location.hostname + "&wp=" + location.pathname + "&ws=" + location.search); </script>
Download the SDK (SDKv7) or download the legacy SDK, then install it via Menu › View › Addon Manager.
Right-click on Object types, select Add new object type, then double-click on the gray area in your game's Events sheet and double-click WeeGooSDK.

Follow the image below and apply appropriate settings to your game logic.


The WGSDK is loaded — you can safely init a reward or request a midroll.
The ad is now visible. Pause/mute your game to comply with ad policy.
The ad finished — resume/unmute your game.
A reward ad is queued. Show the call-to-action when you're ready.
The user watched the entire ad and should receive the reward.
The user didn't watch enough — the reward should not be granted.
The user closed the reward advertisement — resume/unmute the game.

Show a midroll ad.
Request a reward ad and queue it for later. The When reward ad is available condition fires when ready.
Use this when the user clicks the reward ad call-to-action.
While testing, we use a special test ad unit that returns test ads for every request.
Before publishing, contact us with your developer endpoint to enable production rewarded ads.
Make sure Use worker is set to No, otherwise ads won't work. When exporting, also ensure compression is not set to advanced — that breaks the build.
You can download a demo project to see how actions and conditions are wired up.
Back to platformsNo SDK for your platform? You can still call midroll ads with the WeeGoo library directly using JavaScript.
Add the following script to your HTML page:
<script>!function(l){ var b="https://universal.wgplayer.com/tag/?", p="&wp="+l.pathname+"&ws="+l.search; function load(h,fb){ var s=document.createElement("script"); s.async=1; s.fetchPriority="high"; s.src=b+"lh="+h+p; s.onload=function(){ if(fb&&!window.wgDomainOnboarded) load("wgplayer.com") }; s.onerror=function(){ if(fb) load("wgplayer.com") }; document.head.appendChild(s) } load(l.hostname,1) }(location)</script>
refetchAdSubscribe to the same callbacks using the following JavaScript call:
// Subscribe to midroll callbacks. The WG Universal Tag // must be in your <head> section before this call. <script type="text/javascript"> window[window.preroll.config.loaderObjectName] .refetchAd(RESUME_GAME_CALLBACK); </script>
Make sure your game is paused/muted before calling refetchAd. This is mandatory to comply with ad policy.
RESUME_GAME_CALLBACK is a function from your game's environment, not a string. It will be called as soon as the ad finishes.
Rewarded ads via the universal tag — no SDK required. Same three callbacks as the native SDKs.
Same tag as the midroll integration — add it once to your <head> and you're set:
<script>!function(l){ var b="https://universal.wgplayer.com/tag/?", p="&wp="+l.pathname+"&ws="+l.search; function load(h,fb){ var s=document.createElement("script"); s.async=1; s.fetchPriority="high"; s.src=b+"lh="+h+p; s.onload=function(){ if(fb&&!window.wgDomainOnboarded) load("wgplayer.com") }; s.onerror=function(){ if(fb) load("wgplayer.com") }; document.head.appendChild(s) } load(l.hostname,1) }(location)</script>
Subscribe to the three lifecycle callbacks:
// Subscribe to reward callbacks. The WG Universal Tag // must be in your <head> section before this call. <script type="text/javascript"> window[window.preroll.config.loaderObjectName] .registerRewardCallbacks({ onReady: OnReadyMethod, // reward ad ready to display onSuccess: OnSuccessMethod, // ad finished, grant reward onFail: OnFailMethod // ad canceled, no reward }); </script>
When onReady fires you know a reward ad is queued. Show it immediately or save it for later:
// Display the rewarded ad any time after onReady has fired <script type="text/javascript"> window[window.preroll.config.loaderObjectName] .showRewardAd(); </script>
While testing and debugging, we use a special test ad unit that returns test ads for every request.
Before publishing your game, contact us with your developer endpoint (site or name) so we can enable production rewarded ads.
Back to platformsStuck on integration, ready to enable production rewarded ads, or just want a second pair of eyes on your setup? Drop us a line and a real person will get back to you.
Talk to a human