Last active
November 15, 2024 03:24
-
-
Save pricejn2/4ffd0b928327fe8b8edcadb94bedc2dc to your computer and use it in GitHub Desktop.
responsive ad unit with revive ad server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="revive-responsive-top" style="display: block; text-align: center;"> | |
<script type="text/javascript"> | |
adUnit = document.getElementById("revive-responsive-top"); | |
adWidth = adUnit.offsetWidth; | |
if ( adWidth >= 728 ) { | |
/* Leaderboard 728x90 */ | |
adUnit.innerHTML = '<ins data-revive-zoneid="3" data-revive-id="4689b54ec658f530f3250f4124e7f1ea"></ins>'; | |
} else { | |
/* Mobile Banner 320x50 */ | |
adUnit.innerHTML = '<ins data-revive-zoneid="5" data-revive-id="4689b54ec658f530f3250f4124e7f1ea"></ins>'; | |
} | |
</script> | |
<script async src="//revive.example.com/www/delivery/asyncjs.php"></script> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can use without direct link to parent id
var scriptTag = document.getElementsByTagName('script');
scriptTag = scriptTag[scriptTag.length - 1];
var adUnit = scriptTag.parentNode;