Platforms
There is one Y8 SDK. Every platform below is a way of reaching the same JavaScript SDK, loaded from the same URL:
https://cdn.y8.com/minimal-sdk/2-0/y8.min.js
The Unity, Construct 3 and Haxe packages do not reimplement anything — each is a thin wrapper that loads that file at runtime and forwards calls to it. A fix shipped to the SDK reaches all four platforms at once.
Never bundle your own copy
Always load the SDK from the Y8 CDN. A copy bundled into your build freezes at the version you shipped, and fixes will not reach your players.
The 2-0 in the path pins the major line only. Patch releases are served
transparently from the same URL, so there is nothing to update on your side when
one ships.
Choose your platform
For games written directly against the web platform — plain JavaScript, Phaser, PixiJS, or any engine that exports to HTML5 without its own wrapper.
Add the SDK to the <head> of your index.html:
<head>
<script src="https://cdn.y8.com/minimal-sdk/2-0/y8.min.js" async></script>
</head>
This is the reference platform: every SDK capability is available here first, and the examples throughout this documentation are written against it.
Example project — y8-afp-ads-sdk-javascript is a working game showing initialization, advertising and the rest of the SDK in context.
Continue with Getting started.
For Unity games exported to WebGL. Unity 2020 or newer.
- Download the latest package from
unity-sdk-lightweight/releases
and import the
.unitypackageinto your project. - Drag the
Y8Rootprefab fromAssets > Y8into your first scene — the preloader or splash screen, so the SDK is alive before gameplay starts. - Paste your App ID into the
Y8Rootinspector. - Under
Project Settings > Player > Resolution and Presentation, select theY8_ResponsiveWebGL template.
The template in step 4 ships with y8-webgl-template. It sizes the canvas to the player's window, which the Y8 game page expects — Unity's stock templates render at a fixed size and will letterbox.
Calls are asynchronous and return a JsResponse<T>:
using Y8API;
JsResponse<Y8User> response = await Y8.Instance.LoginAsync();
if (response.IsSuccess)
{
Debug.Log(response.Data.nickname);
}
Custom analytics events are not available
Play counting works automatically, but trackCustomEvent has no Unity
equivalent. See Analytics.
For games built in Construct 3.
This is not an addon — there is nothing to install into Construct's addon manager. The integration is a script and an event sheet you copy into your own project:
- Download the example project and open it in Construct 3.
- Copy
main.jsinto your own project's scripts. - Copy the
y8Apievent sheet, and include it from your main event sheet.
The actions and expressions then appear on the event sheet, and main.js
injects the SDK script tag for you at runtime.
Custom analytics events are not available
Play counting works automatically, but there is no action for custom events. See Analytics.
For Haxe games targeting HTML5, including OpenFL and Lime projects.
- Download the Haxe SDK package.
- Copy the
y8folder into your project'sSourcedirectory:
Source/
├── Main.hx
└── y8/
├── Y8.hx
└── js/
└── Y8JS.hx
Y8.hx is a typed wrapper; Y8JS.hx underneath it waits for the SDK to load
and forwards each call. The SDK script itself is declared as a dependency in
project.xml, so Lime injects it into the generated HTML for you.
Some capabilities are unavailable
Custom analytics events and embedded leaderboard/achievement panels have no Haxe equivalent. The modal versions work normally. See Analytics and Leaderboards.
What differs between platforms
Capabilities are the same across platforms except where noted below. Method names are not — each wrapper follows the naming conventions of its own language, so the code samples throughout this documentation carry a tab per platform. Pick your platform on any code sample and the whole site follows.
| Capability | JavaScript | Unity | Construct 3 | Haxe |
|---|---|---|---|---|
| Authentication, player profile | ✅ | ✅ | ✅ | ✅ |
| Advertising | ✅ | ✅ | ✅ | ✅ |
| Leaderboards, achievements (modal) | ✅ | ✅ | ✅ | ✅ |
| Leaderboards, achievements (embedded) | ✅ | ✅ | ✅ | — |
| Cloud storage, images | ✅ | ✅ | ✅ | ✅ |
| Localization, protection | ✅ | ✅ | ✅ | ✅ |
| Automatic play tracking | ✅ | ✅ | ✅ | ✅ |
| Custom analytics events | ✅ | — | — | — |
| Server-side player verification | ✅ | — | — | — |
Where a capability is unavailable, the platform's tab on that page says so rather than leaving the section blank.
Coming from the older Y8 SDK?
Games integrated against the previous SDK — the one built around a global ID
object — continue to work, and there is nothing you must do right now.
A guide for moving to this SDK is not written yet. A compatibility bridge is being considered, which would change what that migration involves, so it is worth waiting rather than rewriting your integration by hand today.
If you are starting a new game, start here.