adx ads
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
window.googletag = window.googletag || {cmd: []};
googletag.cmd.push(function() {
googletag.defineSlot('/23156699239/Display', [300, 250], 'div-gpt-ad-1733978279165-0').addService(googletag.pubads());
googletag.enableServices();
});
</script><!-- /23156699239/Display -->
<div id='div-gpt-ad-1733978279165-0' style='min-width: 300px; min-height: 250px;'>
<script>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1733978279165-0'); });
</script>
</div>
Header 300x50, 300x100, 320x50, 320x100
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
window.googletag = window.googletag || {cmd: []};
// GPT ad slots
var anchorSlot_2;
googletag.cmd.push(function() {
anchorSlot_2 = googletag.defineOutOfPageSlot(/23156699239/Header', googletag.enums.OutOfPageFormat.TOP_ANCHOR);
anchorSlot_2.addService(googletag.pubads());
// Enable SRA and services.
googletag.pubads().enableSingleRequest();
googletag.enableServices();
googletag.display(anchorSlot_2);
});
</script>
Footer
1024x768
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
window.googletag = window.googletag || {cmd: []};
var interstitialSlot;
googletag.cmd.push(function() {
interstitialSlot = googletag.defineOutOfPageSlot('/23156699239/footer',
googletag.enums.OutOfPageFormat.INTERSTITIAL);
interstitialSlot.addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.pubads().set('page_url', 'https://nighttteer.com');
googletag.enableServices();
googletag.display(interstitialSlot);
});
</script>
Reward [out of page, 1x1]
<!-- rewarded -->
<style>
.modal .btn {
padding: .5rem;
background: #2990EA;
border: none;
border-radius: 4px;
margin: 4px;
}
.modal p {
text-align: center;
}
</style>
<script async="async" src="https://securepubads.g.doubleclick.net/tag/js/gpt.js" ></script>
<script>
googletag = window.googletag || {cmd: []};
googletag.cmd.push(() => {
// Check to see if rewarded ad has been shown to this user
const hasShownRewardedAd = localStorage.getItem('hasShownRewardedAd');
const currentTime = Date.now();
if (!hasShownRewardedAd || (currentTime - parseInt(hasShownRewardedAd, 10)) > 10 * 60 * 1000) {
// If it is not displayed or it has been more than 10 minutes, continue processing
const rewardedSlot = googletag.defineOutOfPageSlot('/22140223572/reward',
googletag.enums.OutOfPageFormat.REWARDED).addService(googletag.pubads());
rewardedSlot.setForceSafeFrame(true);
googletag.pubads().enableAsyncRendering();
googletag.enableServices();
const showRewardedAd = () => {
const trigger = document.getElementById('rewardModal');
googletag.pubads().addEventListener('impressionViewable', () => {
// Event when impressions are displayed
console.log('Impression viewable!');
});
googletag.pubads().addEventListener('slotRenderEnded', (event) => {
// Event when the ad finishes showing
if (event.isEmpty) {
console.log('Ad is empty or failed to load');
// Hide modal if ad fails
setTimeout(() => {
trigger.classList.remove('block');
trigger.classList.add('hidden');
}, 0); // Waiting time of 0 seconds before hiding the modal
}
});
googletag.pubads().addEventListener('rewardedSlotReady', evt => {
trigger.classList.remove('hidden');
trigger.classList.add('block');
evt.makeRewardedVisible();
});
googletag.pubads().addEventListener('rewardedSlotClosed', evt => {
// Hide modal after user turns off rewarded ad
trigger.classList.remove('block');
trigger.classList.add('hidden');
// Save information about displayed ads
localStorage.setItem('hasShownRewardedAd', currentTime.toString());
});
googletag.display(rewardedSlot);
};
// Shows ads when the website is loaded
showRewardedAd();
}
});
</script>
<div id="rewardModal" class="hidden modal fixed z-10 pt-80 left-0 top-0 w-full h-full overflow-auto bg-black bg-opacity-5">
<!-- Modal content -->
<div class="modal-content m-auto p-6 bg-slate-100 text-center fixed top-2/4 left-2/4 transform -translate-x-2/4 -translate-y-2/4">
<!-- Display images or content of rewarded ads here -->
<p></p>
<button class="btn"></button>
</div>
</div>
<!-- end rewarded -->
No comments