Forum Moderators: martinibuster
Can I view my own site without generating invalid impressions?
Yes, you're welcome to view your own pages without generating invalid impressions. Simply viewing your pages yourself will not jeopardize your good standing in the AdSense program - however, please continue to avoid clicking on any ads, and don't reload your pages excessively. We take the issue of invalid clicks and page impressions very seriously and have a dedicated team of specialists, as well as automated systems, to flag and review any unusual activity.
Hi martinibuster I used this code...
When I take a close look at a theme I notice they all seem to be doing the same thing: extraneous ad blocks are set to display:none; when the viewport is mobile (or even tablet) sized.
This is typical of most responsive sites, but if you are running a standard Google Adsense Ad Unit, you are breaking the rules.
Even if the div containing the ad unit is hidden, the Javascript is still executed and the ad is still rendered – counting as an impression for the advertiser.
<script type="text/javascript">// <
var width = window.innerWidth || document.documentElement.clientWidth;
google_ad_client = "ca-xxxxxxxxxxxxxxxx";
if (width >= 800) {
google_ad_slot = "ad-unit-1";
google_ad_width = 728;
google_ad_height = 60;
document.write("<script type='text/javascript' src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>");
} else if ((width < 800) && (width > 550)) {
google_ad_slot = "ad-unit-2";
google_ad_width = 468;
google_ad_height = 60;
document.write("<script type='text/javascript' src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>");
}
></script>