GetJar Ads SDK
Version: 1.0.4 Status: Production Ready
The GetJar Ads SDK is a comprehensive advertising monetization solution for HTML5 games. It provides a simple JavaScript API to display banner ads, interstitial ads, and rewarded ads (both display and video) in your web games.
Features
✅ Multiple Ad Formats
- Banner ads (various sizes)
- Interstitial ads (display and video)
- Rewarded ads (display and video)
✅ Server-Side Validation
- Fraud prevention
- Reward frequency capping
- Session management
✅ Network Integration
- Google Ad Manager (GAM)
- Google IMA SDK for video
- Assertive Yield integration
- VAST-compliant video ads
✅ Privacy Compliant
- GDPR support
- COPPA support
- No PII collection
✅ Developer Friendly
- Simple JavaScript API
- TypeScript support
- ~20 KB minified
- Fail-safe design (ads never block gameplay)
✅ Easy Integration
- Works with any HTML5 game framework
- No dependencies required
- Comprehensive documentation
- Active support
Quick Start
1. Add SDK Script
<script src="https://cdn.getjar.com/sdk/getjar-ads.js"></script>
2. Initialize
const sdk = new GetJarAdsSDK();
await sdk.init({
appId: 'your-game-id',
publisher: 'your-publisher-id',
environment: 'production',
privacy: { gdpr: true, coppa: false }
});
3. Show Ads
// Banner ad
sdk.createBanner({
containerId: 'banner-ad',
placement: 'footer',
size: '728x90'
});
// Interstitial ad
sdk.createInterstitial({
placement: 'level_complete',
onComplete: () => console.log('Ad finished')
});
// Rewarded ad
sdk.showRewarded({
placement: 'extra_lives',
rewardType: 'lives',
onRewarded: (reward) => {
if (reward.granted) {
// Give player their reward
}
}
});
Architecture
The SDK consists of two main components:
Frontend SDK (Browser)
- Size: ~20 KB minified
- Technology: TypeScript, Webpack
- Ad Rendering: Google Publisher Tag (GPT) + IMA SDK
- Format: UMD (works with any game framework)
Backend API (NestJS)
- Technology: Node.js 20, NestJS, PostgreSQL
- Features: Session management, event tracking, reward validation
- Deployment:
https://ads.getjar.com
┌──────────────────────┐
│ HTML5 Game │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ GetJar Ads SDK │
│ (Browser) │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Backend API │
│ (ads.getjar.com) │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Google Ad Manager │
│ (Ad Serving) │
└──────────────────────┘
Ad Formats
Banner Ads
Fixed-position ads that remain visible during gameplay.
Use Cases: Footer banners, sidebar ads Sizes: 728x90, 300x250, 320x50, 468x60, 970x90
Interstitial Ads
Full-screen ads shown between game states.
Use Cases: Level transitions, game over screens Types: Display ads (GPT) or Video ads (IMA)
Rewarded Ads
Ads that give players in-game rewards upon completion.
Use Cases: Extra lives, bonus coins, power-ups Types: Display ads (GPT) or Video ads (IMA) Features: Server-side validation, frequency capping
Video Ads
VAST-compliant video ads using Google IMA SDK.
Formats: Interstitial video, Rewarded video Features: Skip buttons, progress tracking, error handling
Example Integration
Here's a complete example showing all ad formats:
// Initialize SDK
const sdk = new GetJarAdsSDK();
await sdk.init({
appId: 'bubble-shooter',
publisher: 'famobi',
environment: 'production',
privacy: { gdpr: true, coppa: false }
});
// 1. Banner ad in footer (always visible)
sdk.createBanner({
containerId: 'footer-banner',
placement: 'footer',
size: '728x90'
});
// 2. Interstitial ad after level complete
function onLevelComplete() {
sdk.createInterstitial({
placement: 'level_complete',
onComplete: () => {
// Continue to next level
loadNextLevel();
},
onError: (error) => {
console.warn('Interstitial failed:', error);
loadNextLevel(); // Continue anyway
}
});
}
// 3. Rewarded video for extra lives
function watchAdForLives() {
sdk.showRewardedVideo({
placement: 'extra_lives',
rewardType: 'lives',
rewardAmount: 3,
onRewarded: (reward) => {
if (reward.granted) {
// Server validated - give reward
player.lives += 3;
showMessage('You earned 3 lives!');
} else {
showMessage('Reward not available. Try again later.');
}
},
onError: (error) => {
console.warn('Rewarded video failed:', error);
showMessage('Video not available right now.');
}
}, 'https://pubads.g.doubleclick.net/gampad/ads?...');
}
Total code: ~40 lines for complete ad integration
Browser Support
| Browser | Version | Support |
|---|---|---|
| Chrome | 90+ | ✅ Full |
| Firefox | 88+ | ✅ Full |
| Safari | 14+ | ✅ Full |
| Edge | 90+ | ✅ Full |
| Mobile Safari | iOS 14+ | ✅ Full |
| Chrome Mobile | Android 5+ | ✅ Full |
CDN Availability
Production
<script src="https://cdn.getjar.com/sdk/getjar-ads.js"></script>
Staging
<script src="https://cdn-staging.getjar.com/sdk/getjar-ads.js"></script>
Development
<script src="http://localhost:8080/getjar-ads.js"></script>
Support
Getting Help
- Email: support@getjar.com
- GitHub: Report an issue
- Docs: https://docs.getjar.com
License
© 2026 GetJar. All rights reserved.