Integration to Consent-Management

Created on 30 June 2022, almost 3 years ago
Updated 28 June 2023, almost 2 years ago

Problem/Motivation

Consent management is definitely a big problem for the GTM module. Every time the module is integrated, the developers are faced with the question of how to solve this problem for their customers (usually within a very limited time).

Proposed resolution

I would like to propose a solution to this problem. The COOKiES module β†’ , which I am a maintainer of, offers an API that makes it easy to solve this problem.

There is already a GTM support module in the COOKiES module, but the procedure if consent has not yet been given is rather rough: The entire GTM service is suppressed by deactivating the corresponding Javascript.

It is easily possible to adapt the service to Google's best practices, but the developers of the COOKiES module lack the know-how to do this. We can't dive too deep into the support of each 3rd party integration module. Our intention is to create a convenient API for developers to add additional 3rd party modules into the COOKiES support with as little effort as possible. On the one hand, our sub-modules are intended to provide examples of how developers can integrate their third-party providers themselves, and on the other hand to provide solid basic support.

A submodule or bridge module should be integrated into the GTM module, which connects the GTM module to the consent management of the COOKiES module.

This module can be activated depending on whether you want to use COOKiES or not. Since the COOKiES module follows the modus operandi of many other (proprietary) consent management modules, the code can be a great help for developers to cleanly transfer the GTM module to other systems. In this way, the GTM development team would have an environment to solve standard consent management problems and further develop the API so that updates of the API depend less on external resources.

The COOKiES team would definitely be willing to cooperate if you want to follow this suggestion.

What we can do for you

  • We can give an introduction to the COOKiES module e.g. by video call.
  • We can help to make a basic setup.
  • We can help to find problem-solutions.
  • We can test and review.

Our benefit

We try to establish COOKiES as popular standard for Drupal and I think we would make a big step in this direction.

Your benefit

You can provide a solid Out-Of-Box solution for Consent-Management inside the Drupal open-source ecosystem.
You can give working example-code and instruction to developers, how to integrate the GTM-Module to a Consent-Management.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany jfeltkamp Hamburg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom alexharries

    I'm sad to see there hasn't been a response to your suggestion @JFeltkamp.

    I'm unfortunately not knowledgeable enough about the Google Tag module to know whether I can help you code up a solution, but the organisation I work for use Google Tag and COOKiES and we have received a request to evaluate whether using Google's Consent Mode can be achieved.

    If we can create a patch for the GTag module in-house which we think might have some benefit to other users, we will be sure to post it here.

    Following this topic in the hope that someone much more capable comes up with a decent solution in the meantime!

    /Al

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @alexharries FYI: https://www.drupal.org/project/cookies β†’ contains a Google Tag Manager submodule - is that what you're looking for or are you aware of that and your comment was about Google Consent Mode additions to that?

  • πŸ‡¬πŸ‡§United Kingdom alexharries

    Thank you @Anybody.

    The issue here I think (/assume) is that there might need to be some change in how the GTag module loads the Google Tag script in order to let Google know that the user has declined consent.

    When the COOKiES module is installed, the GTag module can determine if the user has declined consent from the COOKiES module - how I don't yet know - but it would be this check and the subsequent change to how the Google Tag is loaded which would presumably either need to happen in the GTag module, or potentially through a couple of strategically-placed hook alters in the GTag module which an external module could make use of to change how the tag script is loaded.

    All of the above is vapourware/presumption until we can get a clear understanding of how this might work and what capability we already have in the GTag and COOKiES modules.

    Β―\_(ツ)_/Β―

    /Al

  • πŸ‡§πŸ‡ͺBelgium tijsdeboeck Antwerp πŸ‡§πŸ‡ͺ πŸ‡ͺπŸ‡Ί 🌎

    Hi @alexharries, I've posted a comment on this in the cookies issue queue, maybe it helps you: https://www.drupal.org/project/cookies/issues/3364470#comment-15120948 ✨ Add GA4 snippet support in cookies_ga Fixed

  • πŸ‡¬πŸ‡§United Kingdom alexharries

    Thank you @tijsdeboeck.

    So it looks like there is a sandbox module which should provide this functionality:
    https://www.drupal.org/sandbox/gresko8/3267405 β†’

    Downloading and testing now - many thanks.

    /Al

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Apparently this should work with the Cookies module for a while thanks to changes in πŸ› Google Tag manager is loaded without consent Fixed - has anyone confirmed this?

  • πŸ‡ΊπŸ‡ΈUnited States hbrokmeier Wisconsin

    πŸ› Google Tag manager is loaded without consent Fixed does not solve this issue. When consent mode is enabled in google_tag, consent is hardcoded to `denied`:

      if (config.consentMode === true) {
        gtag('consent', 'default', {
          ad_storage: 'denied',
          analytics_storage: 'denied',
          ad_user_data: 'denied',
          ad_personalization: 'denied',
          wait_for_update: 500,
        });
      }

    If the default consent setting in google_tag wasn't hardcoded and could be defined in the module, we could set the default to `granted` and then cookies and google_tag would work nicely together.

  • @alexharries, @hbrokmeier, @damienmckenna @tijsdeboeck

    Everyone, please stop.....let's take a time out for a minute before more damage is done. The information about Google's Consent Mode in these comments is incorrect.

    *No Module should be setting defaults for consent: they shouldn't be hardcoded, nor should they be defined. In fact, no damn Module needs to screw with Consent Mode at all. If you choose to disobey this principle, you WILL pay a price, and you WILL have problems

    *Consent mode defaults are preferably handed in GTM through the use of a template, as Google recommends. Simo Hava is an expert:
    https://www.simoahava.com/custom-templates/consent-mode

    *Consent Mode is NOT a switch or setting that somebody activates like a light switch.

    "Google Consent Mode allows you to configure how Google tags behave based on the consent users choose to provide or withhold through Cookie Consent." and "Google Consent Mode is an alternative to script blocking." -OneTrust

    Why is the approach to Consent Mode so troubled in this Module?

    Here's what's going on: simplistically, there are two ways to deal with consent mode: one through Google Tag Manager, and another through GTAG. You're supposed to choose one, or the other. You are not supposed to do both. But that's exactly what the Module developers have essentially done.

    Since they chose the Google Tag Manager route, they shouln't be using any type of GTAG command. But they are....and you see how f'd up this is.

    By taking the GTAG approach, they have f'ed all the people who might choose to use GTM to interact with their Cookie Consent Banners.

    I'm excited to hear about the Cookies module possibilities....we've about given up on this Module because it hasn't worked correctly since being installed. We're desperate for alternatives.

Production build 0.71.5 2024