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="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" type="text/plain" data-cookieconsent="marketing"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-2028730546517203"
data-ad-slot="2819293335"
data-ad-format="auto"></ins>
<script type="text/plain" data-cookieconsent="marketing">
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

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.

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Inhoud