Manual implementation of prior consent with AdSense/DoubleClick

Please note: This article was originally drafted to help implement Cookiebot prior to the release of the automated cookie control functionality on September 10th 2019.
You may still be using and preferring the manual implementation and markup option. In that case this article may still be relevant for you.

For automatic cookie blocking make sure that your cookie consent banner script includes the data attribute data-blockingmode=”auto” and that “async” is removed from the script example below.

o enable prior consent on ads served by Google AdSense/DoubleClick, add the following attributes (in bold text) to the existing AdSense script:

<script async src="//" type="text/plain" data-cookieconsent="marketing"></script>
<ins class="adsbygoogle"
<script type="text/plain" data-cookieconsent="marketing">
(adsbygoogle = window.adsbygoogle || []).push({});

With AdSense there is no option to opt out of cookies on a session level to display ads without serving cookies. Therefore it is not possible to display ads from AdSense if the user opts out of marketing cookies.

30 day free trial Cookiebot

Cookie scanner, cookie banner, cookie declaration en cookie consent in one solution.

  • Use cookies on your website compliant with GDPR, ePrivacy and cookie legislation
  • Cookie management completely automated
  • Cookie banner based on your corporate identity
  • Automatic composed cookie declaration, always up to date

The Cookiebot solution runs on 500,000+ websites, manages 13 billion User Consents and supports 40+ languages.