Installation & Setup
Get the BZZE Ads SDK installed and configured in your project. Choose your installation method and follow the steps.
Prerequisites
Before you begin, make sure you have:
- A BZZE Ads account (Sign up here)
- An approved app/game in your Publisher Dashboard
- Your App ID and API Key (found in the Dashboard)
- A web project (HTML/JavaScript) - the SDK runs in browsers
Installation Methods
Method 1: CDN (Recommended)
The easiest way to get started. Add the SDK directly from our CDN:
<script src="https://ads.bzze.com/sdk/rewarded.min.js"></script>
✅ Pros:
- Always get the latest version automatically
- No build step required
- Cached across all sites using BZZE Ads
- Works with any web framework
⚠️ Cons:
- Requires internet connection
- Can't work offline
Method 2: Self-Hosted
Download and host the SDK yourself for more control:
# Download the SDK
curl -o rewarded.min.js https://ads.bzze.com/sdk/rewarded.min.js
# Move it to your project
mv rewarded.min.js your-project/js/
Then include it in your HTML:
<script src="/js/rewarded.min.js"></script>
✅ Pros:
- Works offline
- Full control over version updates
- No external dependencies
⚠️ Cons:
- Manual updates required
- Increases your bundle size
Method 3: NPM (For Build Tools)
If you're using a bundler like Webpack, Vite, or Rollup:
Basic Configuration
After installation, initialize the SDK with your credentials:
// Initialize BZZE Ads SDK
RewardedAd.init({
appId: "YOUR_APP_ID", // From Publisher Dashboard
apiKey: "YOUR_API_KEY", // From Publisher Dashboard
userId: "user_12345", // Your user's unique ID
// Callbacks (all optional)
onReward: function(reward) {
console.log('User earned reward!', reward);
// Grant reward to user in your game
},
onNoFill: function() {
console.log('No ads available right now');
},
onError: function(error) {
console.error('Ad error:', error);
}
});
Getting Your Credentials
To find your App ID and API Key:
- Log in to your Publisher Dashboard
- Navigate to My Games
- Select your game/app
- Copy the App ID and API Key
They look like this:
- App ID:
APP_1234567890_abcdefg - API Key:
bzze_xyz123abc456
Verify Installation
Test that the SDK loaded correctly:
// Check if SDK is loaded
if (typeof RewardedAd !== 'undefined') {
console.log('✅ BZZE Ads SDK loaded successfully!');
console.log('SDK Version:', RewardedAd.getInfo().version);
} else {
console.error('❌ SDK failed to load');
}
Open your browser console (F12) and you should see:
✅ BZZE Ads SDK loaded successfully! SDK Version: 2.0.0
Enable Debug Mode (Development)
During development, enable debug mode to see detailed logs:
// Enable debug mode
RewardedAd.enableDebug();
// Now you'll see detailed logs in console
RewardedAd.init({ /* your config */ });
Complete Example
Here's a complete HTML file with the SDK installed and configured:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Game - BZZE Ads Integration</title>
</head>
<body>
<h1>My Awesome Game</h1>
<button id="watchAdBtn">Watch Ad for 100 Coins</button>
<!-- 1. Load BZZE Ads SDK -->
<script src="https://ads.bzze.com/sdk/rewarded.min.js"></script>
<script>
// 2. Initialize SDK
RewardedAd.init({
appId: "APP_1234567890_abcdefg",
apiKey: "bzze_xyz123abc456",
userId: "user_" + Math.random().toString(36).substr(2, 9),
onReward: function(reward) {
alert('You earned 100 coins!');
// Add coins to user balance
},
onNoFill: function() {
alert('No ads available right now');
},
onError: function(error) {
alert('Error: ' + error.message);
}
});
// 3. Show ad when button clicked
document.getElementById('watchAdBtn').addEventListener('click', function() {
RewardedAd.showAd({
rewardPreview: "100 coins"
});
});
</script>
</body>
</html>
Next Steps
🎉 Installation Complete!
Now that the SDK is installed, learn how to show ads and handle rewards.
Show Your First Ad → API Reference →Troubleshooting
SDK not defined error
Problem: RewardedAd is not defined
Solution: Make sure the SDK script tag is before your initialization code. The SDK must load first.
CORS errors
Problem: Cross-origin errors in console
Solution: Your domain must be registered in the Publisher Dashboard. Add it under My Games → Settings → Allowed Domains.
Invalid API Key error
Problem: 401 Unauthorized errors
Solution: Double-check your App ID and API Key. Make sure you copied them correctly from the Dashboard.
For more help, see our Troubleshooting Guide or Contact Support.