In-App Ads
Create and manage rewarded video and interstitial ad instances with event-driven lifecycle callbacks.
TTMinis.createRewardedVideoAd(options)
Creates a rewarded video ad instance.
Parameters
Field | Type | Description | Required |
|
| The ad unit ID. | Yes |
Returns
A RewardedVideoAd instance with the following methods:
Method | Description |
| Displays the ad. |
| Listens for the ad close event. The callback receives |
| Removes the ad close event listener. |
| Listens for the ad error event. The callback receives |
| Removes the ad error event listener. |
Example
const rewardedAd = TTMinis.createRewardedVideoAd({
adUnitId: 'rewarded_ad_unit_001',
});
rewardedAd.onClose(function (res) {
if (res.isEnded) {
console.log('User watched the rewarded video to the end');
} else {
console.log('User closed the rewarded video early');
}
});
rewardedAd.onError(function (err) {
console.error('rewardedAd error:', err);
});
rewardedAd.show().catch(function (err) {
console.error('rewardedAd show failed:', err);
});TTMinis.createInterstitialAd(options)
Creates an interstitial ad instance.
Parameters
Field | Type | Description | Required |
|
| The ad unit ID. | Yes |
Returns
An InterstitialAd instance with the following methods:
Method | Description |
| Displays the ad. |
| Listens for the ad close event. |
| Removes the ad close event listener. |
| Listens for the ad error event. The callback receives |
| Removes the ad error event listener. |
Example
const interstitialAd = TTMinis.createInterstitialAd({
adUnitId: 'interstitial_ad_unit_001',
});
interstitialAd.onClose(function () {
console.log('interstitial ad closed');
});
interstitialAd.onError(function (err) {
console.error('interstitialAd error:', err);
});
interstitialAd.show().catch(function (err) {
console.error('interstitialAd show failed:', err);
});