Ad - AdSense

> Marketing > Advertising

1 - About

AdSense is the Ad Network of Google.

It's intended to be simple. If you want more control, you need to use the AdManager.

Advertising

3 - Script

The adsense script is pagead2.googlesyndication.com/pagead/js/adsbygoogle.js that is loaded in a header.

<head>
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</head>

Adding an ad unit ask two piece of code:

<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9530166455702489"
     data-ad-slot="9424922515"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
  • And a push script
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

Why the push ?

  • When adsbygoogle.js has not yet loaded, then adsbygoogle.push({}) makes an array one element longer
  • When adsbygoogle.js loads, it iterates through the array, processing one ad slot for each entry.

4 - Glossary

  • An AdUnit represents an ad location on one or more pages.