Debug Mode
Use Debug Mode to see detailed logs, test your integration, and troubleshoot issues during development.
â ī¸ Development Only: Debug mode logs sensitive information and affects performance. Always disable it in production!
Enable Debug Mode
Call enableDebug() before initializing the SDK:
JavaScript
// Enable debug mode FIRST
RewardedAd.enableDebug();
// Then initialize
RewardedAd.init({
appId: "YOUR_APP_ID",
apiKey: "YOUR_API_KEY",
userId: "user_12345",
onReward: function(reward) {
console.log('Reward!', reward);
}
});
What You'll See
With debug mode enabled, the console will show:
đ [BZZE Ads] Debug mode enabled
đ§ [BZZE Ads] Initializing SDK v2.0.0
â
[BZZE Ads] SDK initialized successfully
đĻ [BZZE Ads] Preloading 1 ad(s)...
đ [BZZE Ads] API Request: POST /v1/ads/request
đ [BZZE Ads] Request params: {appId: "APP_123", userId: "user_456"}
â
[BZZE Ads] Ad loaded: House Campaign (30s)
đē [BZZE Ads] Showing ad: House Campaign
đī¸ [BZZE Ads] Ad is 50%+ visible for 2+ seconds (viewable impression tracked)
đŦ [BZZE Ads] Ad progress: 25%
đŦ [BZZE Ads] Ad progress: 50%
đŦ [BZZE Ads] Ad progress: 75%
â
[BZZE Ads] Ad completed! User earned reward
đ° [BZZE Ads] Reward granted: {earned: true, timestamp: 1698789012345}
Disable Debug Mode
Turn off debug mode anytime:
JavaScript
// Disable debug logging
RewardedAd.disableDebug();
Debug Methods
getInfo()
Get SDK version and configuration:
JavaScript
const info = RewardedAd.getInfo();
console.log(info);
// Output:
// {
// version: "2.0.0",
// initialized: true,
// appId: "APP_1234567890_abc",
// userId: "user_12345",
// preloadedAds: 1
// }
getAnalytics()
Get session analytics:
JavaScript
const analytics = RewardedAd.getAnalytics();
console.log(analytics);
// Output:
// {
// impressions: 5,
// completions: 4,
// clicks: 1,
// errors: 0,
// viewableImpressions: 5,
// fillRate: 100
// }
isAdAvailable()
Check if ads are ready:
JavaScript
if (RewardedAd.isAdAvailable()) {
console.log('â
Ads are ready!');
enableAdButton();
} else {
console.log('â No ads available');
disableAdButton();
}
Common Debug Scenarios
Test Successful Ad Flow
JavaScript
RewardedAd.enableDebug();
RewardedAd.init({
appId: "APP_1760726660483_6ohdjjgqm",
apiKey: "bzze_fgpwe6uofk9",
userId: "test_user_" + Date.now(),
onAdLoaded: function(count) {
console.log('â
Test: Ad loaded!', count);
},
onAdShown: function() {
console.log('â
Test: Ad is playing');
},
onReward: function(reward) {
console.log('â
Test: Reward earned!', reward);
},
onClose: function() {
console.log('âšī¸ Test: Ad closed');
}
});
// Show ad after 2 seconds
setTimeout(() => {
console.log('đŦ Test: Showing ad...');
RewardedAd.showAd({
rewardPreview: "TEST: 100 coins"
});
}, 2000);
Test Error Handling
JavaScript
RewardedAd.init({
appId: "INVALID_APP_ID", // â Intentionally wrong
apiKey: "INVALID_KEY",
userId: "test_user",
onError: function(error) {
console.error('â
Test: Error caught!', error);
console.log('Error code:', error.code);
console.log('Error message:', error.message);
}
});
RewardedAd.showAd(); // This will trigger onError
Test Rate Limiting
JavaScript
// Show 11 ads rapidly to trigger hourly limit (default: 10/hour)
for (let i = 0; i < 11; i++) {
setTimeout(() => {
console.log(\`Attempt \${i + 1}/11\`);
RewardedAd.showAd();
}, i * 3000); // 3 seconds apart
}
// After 10 ads, you should see:
// â° [BZZE Ads] Rate limit reached. Wait 60 seconds.
Production Checklist
Before going live, make sure to:
- â
Remove
RewardedAd.enableDebug()call - â
Remove all
console.log()test statements - â Test with real App ID and API Key
- â Verify GDPR/COPPA compliance if needed
- â Test on mobile devices
- â Test with slow 3G network
Debug Tips
- Open console early: Press F12 before loading your game
- Filter logs: Type "BZZE" in console filter to see only SDK logs
- Test on different devices: iOS, Android, Desktop
- Simulate no-fill: Pause all campaigns in dashboard
- Test VAST errors: Use invalid VAST URLs to trigger error codes
See Also
- Testing Checklist - Complete testing guide
- Troubleshooting - Common issues and fixes
- Analytics Methods - Track performance