Interstitial Ad Format
Full-screen ads that cover the entire app interface. Includes both image and video ads (video more common), typically skippable after 5 seconds.
How It Works

Loading Ads
You can load ads throughInterstitialAd.loadAd(unitId).
- Non-Reward
- Reward
Copy
Ask AI
import { InterstitialAd } from "react-native-daro";
import { AdInfo, AdLoadFailedInfo, AdRevenueInfo } from "react-native-daro";
Copy
Ask AI
const INTERSTITIAL_AD_UNIT_ID = Platform.select({
ios: ${iOS unit Id},
android: ${Android unit id},
default: ''
});
const initializeInterstitialAds = () => {
InterstitialAd.addAdLoadedEventListener((adInfo: AdInfo) => {...});
InterstitialAd.addAdLoadFailedEventListener((errorInfo: AdLoadFailedInfo) => {...});
InterstitialAd.addAdClickedEventListener((adInfo: AdInfo) => { ... });
InterstitialAd.addAdDisplayedEventListener((adInfo: AdInfo) => { ... });
InterstitialAd.addAdFailedToDisplayEventListener((adInfo: AdDisplayFailedInfo) = { ... });
InterstitialAd.addAdHiddenEventListener((adInfo: AdInfo) => { ... });
InterstitialAd.addAdImpressionRecordedListener((adInfo: AdInfo) => { ... });
// Load the first interstitial
loadInterstitial();
}
const loadInterstitial = () => {
InterstitialAd.loadAd(INTERSTITIAL_AD_UNIT_ID);
}
Showing Ads
You can show loaded ads throughInterstitialAd.showAd(unitId).
Copy
Ask AI
const isInterstitialReady = await InterstitialAd.isAdReady(
INTERSTITIAL_AD_UNIT_ID
);
if (isInterstitialReady) {
InterstitialAd.showAd(INTERSTITIAL_AD_UNIT_ID);
}
Implementation Example
This is an example implementation of `InterstitialAd`.
This is an example implementation of `InterstitialAd`.
Copy
Ask AI
import { useEffect, useRef, useState } from "react";
import { StyleSheet } from "react-native";
// For import statements, refer to the tabs above
import { AdDisplayFailedInfo, AdInfo, AdLoadFailedInfo, AdRevenueInfo, InterstitialAd } from "react-native-daro-m";
import { ThemedButton } from "../ThemedButton";
enum AdLoadState {
notLoaded = 'NOT_LOADED',
loading = 'LOADING',
loaded = 'LOADED',
}
type Props = {
adUnitId: string;
isInitialized: boolean;
log: (str: string) => void;
};
const MAX_EXPONENTIAL_RETRY_COUNT = 3;
const InterstitialAdExample = ({ adUnitId, isInitialized, log }: Props) => {
const [adLoadState, setAdLoadState] = useState<AdLoadState>(AdLoadState.notLoaded);
const retryAttempt = useRef(0);
useEffect(() => {
InterstitialAd.addAdLoadedEventListener((adInfo: AdInfo) => {
setAdLoadState(AdLoadState.loaded);
retryAttempt.current = 0;
log(`Interstitial ad loaded`);
});
InterstitialAd.addAdImpressionRecordedListener((adInfo: AdRevenueInfo) => {
log(`Interstitial ad revenue paid`);
});
InterstitialAd.addAdClickedEventListener((adInfo: AdInfo) => {
log(`Interstitial ad clicked`);
});
// Handle ad load failure
InterstitialAd.addAdLoadFailedEventListener((errorInfo: AdLoadFailedInfo) => {
setAdLoadState(AdLoadState.notLoaded)
if (retryAttempt.current > MAX_EXPONENTIAL_RETRY_COUNT) {
log('Interstitial ad failed to load with code ' + errorInfo.code);
return;
}
// Interstitial ad failed to load
// We recommend retrying with exponentially higher delays up to a maximum delay (in this case 64 seconds)
retryAttempt.current += 1;
const retryDelay = Math.pow(2, Math.min(MAX_EXPONENTIAL_RETRY_COUNT, retryAttempt.current));
log('Interstitial ad failed to load with code ' + errorInfo.code + ' - retrying in ' + retryDelay + 's');
setTimeout(() => {
setAdLoadState(AdLoadState.loading);
log('Interstitial ad retrying to load...');
InterstitialAd.loadAd(adUnitId);
}, retryDelay * 1000);
});
InterstitialAd.addAdDisplayedEventListener((adInfo: AdInfo) => {
log(`Interstitial ad displayed`);
});
InterstitialAd.addAdFailedToDisplayEventListener((adInfo: AdDisplayFailedInfo) => {
setAdLoadState(AdLoadState.notLoaded);
log(`Interstitial ad failed to display`);
});
InterstitialAd.addAdHiddenEventListener((adInfo: AdInfo) => {
setAdLoadState(AdLoadState.notLoaded);
log(`Interstitial ad hidden`);
});
}, [adUnitId]);
const getInterstitialButtonTitle = () => {
if (adLoadState === AdLoadState.notLoaded) {
return 'Load Interstitial';
} else if (adLoadState === AdLoadState.loading) {
return 'Loading...';
} else {
return 'Show Interstitial'; // adLoadState.loaded
}
};
return (
<ThemedButton
isEnabled={isInitialized && adLoadState !== AdLoadState.loading}
isLoading={adLoadState === AdLoadState.loading}
title={getInterstitialButtonTitle()}
onPress={async () => {
const isInterstitialReady = await InterstitialAd.isAdReady(adUnitId);
if (isInterstitialReady) {
InterstitialAd.showAd(adUnitId);
} else {
log('Loading interstitial ad...');
setAdLoadState(AdLoadState.loading);
InterstitialAd.loadAd(adUnitId);
}
}} />
);
}
const styles = StyleSheet.create({
button: {
margin: 5,
},
});
export default InterstitialAdExample;

