Complianz and Advertising: Personalized Ads based on Consent

Dynamic advertising based on consent.

Aert

Aert

Junior Developer & Support

Categories

Most Popular Articles

Subscribe to our newsletter

    For EU Subscribers | Privacy Statement
    For USA Subcribers | Privacy Statement

  • This field is for validation purposes and should be left unchanged.

For this configuration we will work with the following plugins and tools:

  1. Complianz | GDPR Cookie Consent
  2. Google Tag Manager
  3. Ad Inserter (other plugins and implementations will work)

Configuring Complianz | GDPR Cookie Consent (or Complianz Privacy Suite)

When completing the wizard, please let Complianz implement your Google Tag Manager code so Complianz can handle consent for you.

Under Cookies > Cookie Usage please say Yes to Tag Manager fires scripts that places cookies.

Go to Cookies > Statistics and enter your Google Tag Manager code. Which looks like below image:

Complianz

After finishing the wizard, configure your Cookie Banner with categories. For easy implementation you can use the following:

  1. Functional Cookies ( No advertising)
  2. Statistics (Non-personalized Advertising)
  3. Marketing (Personalized Advertising

To fire the scripts per category, you will need to add custom events (triggers) to your Tag Manager Workspace. For the above categories the custom events are as follows; (please double check if this applies to you as well, when creating the categories more information will be available in the wizard)

  1. Functional Cookies (cmplz_event_functional or “All Pages”)
  2. Statistics (cmplz_event_0)
  3. Marketing (cmplz_event_all)

Configuring the Adsense Code with Ad Inserter*

*this works for most plugins and custom implementations.

Removing the scripts from you Adsense Code

We want to manually edit the script code from Adsense and only fire the script when consent is given, for either Statistics (Non-personalized Ads) or Marketing (Personalized Ads). Instead of:

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

<ins class="adsbygoogle"
style="display:block; text-align:center;width:320px;height:100px"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-*************"
data-ad-slot="3032682906"> </ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

We want to extract the script tags (normally in <>) and only have the ins remaining per ad slot in Ad Inserter. See this image for an example:

We will add the script tags with Google Tag Manager, while adding consent and the variables for Non-Personalized and Personalized Ads.

Configuring Tag Manager

Now we will add the Adsense script tags and triggers to Tag Manager so ads will be shown based on specific categories or consent.

Triggering Personalized Ads

You will need a trigger based on the custom event cmplz_event_all (Marketing, see above explanation) and you will trigger Custom HTML with the Adsense script and added variable.

1. Create a new trigger configuration
2. Choose: Some custom events
3. Choose: “equals”
4. Add: cmplz_event_all

After, create a new tag with the above trigger.

1. Create a Tag with Custom HTML
2. Add below HTML to the editable field.
3. Choose the trigger you’ve just made

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
 (adsbygoogle = window.adsbygoogle || []).requestNonPersonalizedAds =0;
 (adsbygoogle = window.adsbygoogle || []).push({});
</script>

Triggering Non-Personalized Ads

You will need a trigger based on the custom event cmplz_event_0 (Statistics, see above explanation) and you will trigger Custom HTML with the Adsense script and added variable.

1. Create a new trigger configuration
2. Choose: Some custom events
3. Choose: “equals”
4. Add cmplz_event_0 or your custom event.

After, create a new tag with the above trigger.

1. Create a Tag with Custom HTML
2. Add below HTML to the editable field.
3. Choose the trigger you’ve just made
3. Add the other trigger “Marketing” as an exception.

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
 (adsbygoogle = window.adsbygoogle || []).requestNonPersonalizedAds =1;
 (adsbygoogle = window.adsbygoogle || []).push({});
</script>

Checking if your Ads are Personalized or Non-Personalized.

In order to check if non-personalized AdSense ads are displayed, you need to open the browser console. For Chrome this can be opened with a right-mouse click and choose “Inspect”.

Make sure you have your Tag Manager container on preview, so you can debug the triggers and tags set and check if the ads should be personalized or non-personalized and what might be the issue if you’re encounter anything out of the ordinary.

Go to the Network panel, which displays all requests your site is doing to load resources.

If you opened that panel after your site was loaded it might not show all requests, so please reload the page while keeping the panel open.

Once reloaded, you should filter the list by searching for “ads”. Among the results should be a call that starts with ads?client=capub.

Each manually placed ad and the Auto ads code has its individual request, so you could see more than one result. You can check every one of them, but in the best case, they all behave the same regarding non-personalized ads.

The only difference between a request for non-personalized and personalized ads is an additional NPA parameter.

Click on the request to see more details. You should be in the Headers tab by default and see the Request URL entry at the top. It will look like below image.

Double click on that entry and copy it completely into a text editor of your choosing.

Now, use the search functionality of your text editor to look for the string “NPA”. The value doesn’t matter since it is either set if non-personalized ads are delivered or missing completely if AdSense delivers personalized ads.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.

© Copyright - Complianz 2019
×

Complianz Privacy Suite 3.1 is live!

See our new features and available documentation. Read more