Standalone solution (beta)
Overview
The Playgama Ads SDK provides a simple interface for displaying interstitial and rewarded advertisements on web platforms.
Beta Access
Playgama Ads is currently available in closed beta.
To request access, please contact us at [email protected].
Installation
<script src="https://playgama.com/ads/common.v0.1.js"></script>Quick Start
// Initialize the SDK
await window.pgAds.init();
window.pgAds.updateTargeting({ playgama_clid: '<your-clid>', gameId: '<game-identifier>' });
// Show Interstitial Ads
const ads = await window.pgAds.requestOutOfPageAd('interstitial');
if (ads.state === 'ready') {
ads.show();
} else {
ads.addEventListener('ready', () => {
ads.show();
});
}API Reference
pgAds.init(): Promise<void>
pgAds.init(): Promise<void>Initialize the ads service before requesting ads.
pgAds.updateTargeting(targeting): void
pgAds.updateTargeting(targeting): voidUpdate targeting parameters for ad requests. Use this to identify your traffic source.
Parameters:
targeting(object): Key-value pairs for ad targeting
Example:
pgAds.requestOutOfPageAd(type, timeout?): Promise<OutOfPageBanner>
pgAds.requestOutOfPageAd(type, timeout?): Promise<OutOfPageBanner>Request an advertisement that displays over your content.
Parameters:
type(string): Ads type -interstitialorrewardedtimeout(number, optional): Request timeout in milliseconds (default: 1000ms)
Ad Types:
interstitial- Full-screen ad shown between contentrewarded- Video ad that rewards the user upon completion
Event Handling
Listen for ad events to handle user interactions:
Last updated