Responsive Adsense
Google seems to have moved away from the old sizes (things like the 250px square, 480px and 728px banners, etc) and now offers full width adverts, that are automatically responsive. So, no need to add your own responsive code anymore, just put the ads on the page and Google does the rest. Sweet.
The code used to generate an adsense ad or link unit looks like this. This particular code is for a link block, but the code for adverts looks the same apart from the data-ad-format="link"
.
<section class="noprint">
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-xxxxxxxxxx"
data-ad-slot="xxxxxxxxxx" data-ad-format="link" data-full-width-responsive="true"></ins>
<script>(adsbygoogle=window.adsbygoogle||[]).push({});</script>
</section>
The Adsense Script
When you generate adsense code, it comes with a javascript. So if you have 3 blocks of adsense or adlinks on a page, that is 3 scripts that look like this...
<script async src="//pagead2.googlesyndication.com /pagead/js/adsbygoogle.js"> </script>
But you actually only need this once per page, there is no need or benefit to calling for it multiple times. So with that in mind, this script is placed below the footer into an include tag called . We have it in an include so that on pages that don't have adsense on them (perhaps disclaimers, contact, privacy etc) we can comment out the include tag to save calling it. Just remember to remove the comment tags on pages that do have adsense on them, or it won't display!
When you generate the code from your Adsense account, you can safely leave out that bottom script that comes with it... we already have it, and it's the same script for everyone, it's not unique to you. And be aware - Adsense will give you a performance hit, the same way most 3rd party code will. Google and Facebook are probably two of the worst offenders in this respect. It's just the price you (and your visitors) pay for having adverts.