Hoe te installeren

Hoe installeer ik consent.studio in combinatie met gtag.js

Installatie met gtag.js, in plaats van Google Tag Manager

Installatie van de consent.studio CMP voor Google Consent Mode v2 in combinatie met gtag.js

We raden u aan een tagbeheersysteem te gebruiken, met name Google Tag Manager, om consent.studio en misschien andere tags te implementeren.

Vereisten

  • Zorg ervoor dat je basiskennis hebt van HTML en JavaScript voordat je deze installatiemethode gebruikt.
  • Zorg ervoor dat je het verschil begrijpt tussen Google Tag Manager en gtag.js. Dit helpartikel van Google kan je helpen het verschil te begrijpen.
  • Zorg ervoor dat u de toestemmingsmodus van Google en de verschillende soorten toestemmingssignalen en de optie voor het redigeren van gegevens begrijpt.

1. Zorg ervoor dat je een account hebt bij consent.studio

Log in op https://consent.studio. Als je nog geen account hebt, kun je er hier een aanmaken:

Een account aanmaken

2. Voeg dit script toe aan je website

We raden aan om het volgende script toe te voegen al na het openen van de <head> element van uw HTML-pagina zo mogelijk en vóór de initialisatie van gtag.js.

This script has placeholders. Make sure that you replace them.

  • The site domain that you have registered with consent.studio: [YOUR DOMAIN HERE]

Also...

  • ...if needed, adjust the default consent signals;
  • ...if needed, adjust the default wait_for_update parameter;
  • ...and remove any other CMP that may have already been installed on your page to prevent conflicts

<script type="text/javascript">
  /**
   * Manual implementation of the consent.studio CMP
   * - Remember to replace the following placeholders: [YOUR DOMAIN HERE]
   * - Remember to adjust the default consent signals if needed
   */

  /** Initialize the dataLayer variable */
  window.dataLayer = window.dataLayer || [];

  /** Define a short-hand function for writing to the dataLayer */
  function gtag(){dataLayer.push(arguments);}

  if(window.location.hash ? window.location.hash == '#cs-scan' : false)
  {
     /** Don't touch: set all consent signals to granted for the consent.studio cookie scanner */
     gtag("consent","default",{ad_storage:"granted",ad_user_data:"granted",ad_personalization:"granted",analytics_storage:"granted",functionality_storage:"granted",personalization_storage:"granted",security_storage:"granted",wait_for_update:500});
  }
     else
  {
     /**
      * Set the default consent signals
      * (You may edit these defaults)
      */
     gtag("consent", "default", {
        ad_storage: "denied",
        ad_user_data: "denied",
        ad_personalization: "denied",
        analytics_storage: "denied",
        functionality_storage: "granted",
        personalization_storage: "granted",
        security_storage: "granted",
        wait_for_update: 500,
     });
  }

  /**
   * Set a value for ads data redaction
   * - More information: https://support.google.com/analytics/answer/13544947?hl=en
   */
  gtag("set", "ads_data_redaction", true);

  /** Set the consent.studio developer ID */
  gtag("set", "developer_id.dZTlmZj", true);
</script>

<script src="https://consent.studio/[YOUR DOMAIN HERE]/banner.js"></script>

What does this script do?

Firstly, it defines the basics: it initialises the dataLayer variable and provides us with a shorthand function to easily push information to this variable.

Secondly, we set the default consent signals for Google Consent Mode. In our example, all categories (except security_storage) are instructed to default to denied. This is the same behaviour that our Google Tag Manager tag template has.

Thirdly, we set the value for ads_data_redaction. As referred to from the code snippet above, more information about this flag can be found here in the official documentation by Google. Accepted values are true and false.

Then, the consent.studio developer ID is set. This is our signature use so that Google can recognise our CMP.

Lastly, we will load the actual banner script into the website.

3. Customise your cookie banner

You can do so in your consent.studio dashboard. More details can be found in this article.

4. Monitor your implementation

Now that you have finalised your implementation, we recommend keeping an eye on what your consent.studio dashboard (we have a health check page that becomes available to you when issues are detected by our scanner) and the implementation status from within Google services (such as Google Analytics and Google Ads) inform you about.

Please contact consent.studio first, before contacting Google support.

Also, please keep an eye on whether our cookie scanner actually finds cookies on your website. If your website does use cookies, but our scanner does not find any, it may because of any of these causes:

  • You do not have the correct domain registered with consent.studio;
  • You have another CMP installed on the domain;
  • No scan has ran just yet (please wait up to 15 minutes after registration for your initial scan to start);
  • Advanced: your page is protected with "basic authentication", i.e. through a .htpasswd file.

Inhoudsopgave