RewardedAd.getCooldownRemaining()

Get the remaining cooldown time (in seconds) before the next ad can be shown.

Syntax

JavaScript
RewardedAd.getCooldownRemaining()

Description

The getCooldownRemaining() method returns the number of seconds remaining before the user can watch another ad. This is part of BZZE Ads' frequency capping system to prevent ad spam and improve user experience.

ℹ️ Cooldown Period: By default, users must wait 60 seconds (1 minute) between ad views. This prevents spam and ensures ad quality. The cooldown is enforced client-side and server-side for security.

Parameters

None

Return Value

Type: number

  • 0 - No cooldown, user can watch an ad immediately
  • 1-60 - Seconds remaining until next ad can be shown
  • Example: 45 means 45 seconds remaining

Examples

Basic Cooldown Check

JavaScript
const cooldown = RewardedAd.getCooldownRemaining();

if (cooldown === 0) {
    console.log('✅ Ready to show ad!');
    RewardedAd.showAd();
} else {
    console.log(`⏳ Please wait ${cooldown} seconds`);
}

Display Countdown Timer

JavaScript
const button = document.getElementById('rewardButton');

function updateCooldownUI() {
    const remaining = RewardedAd.getCooldownRemaining();
    
    if (remaining === 0) {
        button.disabled = false;
        button.textContent = '▶️ Watch Ad for Reward';
    } else {
        button.disabled = true;
        button.textContent = `⏳ Wait ${remaining}s`;
    }
}

// Update every second
setInterval(updateCooldownUI, 1000);
updateCooldownUI(); // Initial update

Formatted Time Display

JavaScript
function formatCooldown(seconds) {
    if (seconds === 0) return 'Ready now!';
    if (seconds < 60) return `${seconds}s`;
    
    const mins = Math.floor(seconds / 60);
    const secs = seconds % 60;
    return `${mins}m ${secs}s`;
}

// Usage
const cooldown = RewardedAd.getCooldownRemaining();
console.log('Cooldown:', formatCooldown(cooldown));
// Output: "Cooldown: 45s" or "Cooldown: 1m 15s"

Smooth Progress Bar

JavaScript
const MAX_COOLDOWN = 60; // 60 seconds
const progressBar = document.getElementById('cooldownProgress');
const progressText = document.getElementById('cooldownText');

function updateProgress() {
    const remaining = RewardedAd.getCooldownRemaining();
    const progress = ((MAX_COOLDOWN - remaining) / MAX_COOLDOWN) * 100;
    
    progressBar.style.width = `${progress}%`;
    
    if (remaining === 0) {
        progressText.textContent = '✅ Ready!';
        progressBar.style.backgroundColor = '#10b981'; // Green
    } else {
        progressText.textContent = `⏳ ${remaining}s`;
        progressBar.style.backgroundColor = '#f59e0b'; // Orange
    }
}

setInterval(updateProgress, 100); // Smooth update

React Hook with Cooldown

JavaScript
import { useState, useEffect } from 'react';

function AdButton() {
    const [cooldown, setCooldown] = useState(0);
    
    useEffect(() => {
        const interval = setInterval(() => {
            const remaining = RewardedAd.getCooldownRemaining();
            setCooldown(remaining);
        }, 1000);
        
        return () => clearInterval(interval);
    }, []);
    
    const isReady = cooldown === 0;
    
    return (
        
{!isReady && (
)}
); }

User-Friendly Notification

JavaScript
function tryShowAd() {
    const cooldown = RewardedAd.getCooldownRemaining();
    
    if (cooldown === 0) {
        // No cooldown, show ad
        RewardedAd.showAd({
            rewardPreview: '100 coins'
        });
    } else {
        // Show friendly message
        const message = cooldown < 10 
            ? `Almost ready! ${cooldown} seconds...`
            : `Please wait ${cooldown} seconds before the next ad.`;
        
        showNotification(message, 'warning');
    }
}

function showNotification(message, type) {
    // Your notification system
    alert(message);
}

Common Use Cases

1. Button State Management

Disable buttons during cooldown:

JavaScript
const button = document.getElementById('adButton');
button.disabled = RewardedAd.getCooldownRemaining() > 0;

2. User Feedback

Show clear countdown to users:

JavaScript
const remaining = RewardedAd.getCooldownRemaining();
if (remaining > 0) {
    showToast(`Next ad available in ${remaining}s`);
}

3. Alternative Actions

Offer alternatives during cooldown:

JavaScript
if (RewardedAd.getCooldownRemaining() > 0) {
    // Show alternative reward options
    showPurchaseOptions();
    showDailyBonusOption();
}

Frequency Capping Details

BZZE Ads enforces frequency limits to ensure quality:

Limit Type Value Enforcement
Between Ads 60 seconds Client + Server
Per Hour 10 ads Server-side
Per Day 50 ads Server-side
⚠️ Important: The cooldown is a minimum wait time. Even if the cooldown is 0, there may be no ads available due to other limits (hourly/daily caps, no fill from ad networks, etc.).

Best Practices

✅ DO:
  • Show cooldown timer to users for transparency
  • Disable buttons during cooldown
  • Offer alternative actions during wait time
  • Use smooth progress bars for better UX
  • Update UI every second for accuracy
⚠️ DON'T:
  • Try to bypass cooldown (it's enforced server-side)
  • Show ads without checking cooldown first
  • Leave users guessing when next ad is available
  • Update too frequently (avoid every ms)

Related Methods

See Also