Code: Select all
<div style="margin: 0 auto; text-align: center;"><a href="http://link" onclick="window.open(this.href); return false;"><img src="url.jpg" width="600" height="60" alt="" style="border:1px solid black;" /></a></div>
Code: Select all
<div class="google-468" id="google-468">
YOUR_ADSENSE_CODE_HERE
</div>
<div id="google-468-responsive">
MOBILE_ADSENSE_CODE_HERE
</div>
Code: Select all
/* Google ads
----------------------------------------*/
#google-468 {
float: right;
/* width: 468px;
height: 60px; */
margin-top: 8px;
}
#google-468-responsive {
display:none!important;
}
Code: Select all
/* Google ads responsive
----------------------------------------*/
#google-468 {
display: none;
}
#google-468-responsive {
text-align: center;
width: 99%;
float: left;
display: inline!important;
padding: 0;
margin: 0;
}
Code: Select all
<script type="text/javascript">
google_ad_client = 'whatever';
google_ad_slot = 'whatever';
google_ad_width = 768;
google_ad_height = 90;
var width = document.documentElement.clientWidth;
if (width < 800)
{
google_ad_slot = 'whatever';
google_ad_width = 468;
google_ad_height = 60;
}
if (width < 500)
{
google_ad_slot = 'whatever';
google_ad_width = 320;
google_ad_height = 50;
}
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
For more ads of the same adsense code (Google 468 banner for example), you could just use more CSS. No problem with ad views/clicks because they are hidden, and are different banners (Desktop and mobile). I'll look into your method though cheers. But current setup does work well, going to add some <IF> statements too so that they only load on chosen page etc.Arty wrote:That would load multiple ads, which might cause other ads to be empty and increase ad views counter.
Code: Select all
$(document).ready(function(){
setTimeout("checkAds();", 250);
});
function checkAds() {
if ($("#google-468-responsive").css('display') == 'none') {
$("#google-468-responsive").replaceWith('');
}
}
Code: Select all
$(window).bind('resize', function(e)
{
if (window.RT) clearTimeout(window.RT);
window.RT = setTimeout(function()
{
this.location.reload(false); /* false to get page from cache */
}, 250);
});