Documentation

Table of Contents

Prior Blocking of Cookies: Google AdSense and Ad Manager

Google AdSense

Below is the original procedure, which allows for the addition of two script tags to your pages:

<script type="text/javascript">
        google_ad_client = "ca-pub-00000000";
        google_ad_slot = "XXXXXXXXXX";
        google_ad_width = 728;
        google_ad_height = 90;
</script>
<script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>

To make sure that the Google AdSense banners don’t save any cookies before user consent, it’s necessary to make these changes:

  1. Define the function iubenda_adsense_unblock associating it to the callback onConsentGiven:

Google Ad Manager

In order to ensure that Google Ad Manager (previously DFP – DoubleClick for Publishers) can install cookies only after obtaining consent from the user, it is necessary to use one of the methods described in this article so that the iubenda Cookie Solution can interact with Google Ad Manager by blocking tracking when the iubenda preference cookie is not present in the user’s browser.

You can choose one of 3 methods available for integration, depending on the Google Ad Manager code version you use.

Caution

The methods proposed for “asynchronous” and “synchronous” code only work for the creativities provided directly by Google Ad Manager.

Method 1 – “asynchronous” code

Below you’ll find the “asynchronous” codes before and after the necessary modifications to the script.

Before (asynchronous)

  • Script for the configuration of Google Ad Manager:

After (asynchronous)

The necessary modifications for the configuration of Google Ad Manager for the blocking of cookies before user consent.

  1. Define the function isConsentGiven for the management of cookie:

The part in the isConsentGiven function in particular gets inserted before the Google Ad Manager script and preferably after the code that initializes the iubenda Cookie Solution.

Method 2 – “synchronous” code

Here below you will find the codes based on the “synchronous” approach before and after the addition of the iubenda modifications.

Before (synchronous)

  • Google Ad Manager configuration script:

After (synchronous)

The necessary modifications for the configuration of Google Ad Manager for the blocking of cookies before user consent.

  1. Define the function isConsentGiven for the management of cookie:

Also in this case the code with the function isConsentGiven should be inserted before DFP and preferably after the iubenda script.

Method 3

Last but no least, if the creativities originate from services outside, the following codes need to be used instead.

Code without modifications

  • Inclusion of the Google Ad Manager script:

Necessary modifications for the correct functioning of the iubenda Cookie Solution

  1. Add the class _iub_cs_activate to the Google Ad Manager script:

See also

Still have questions?

Visit our support forum Email us