Add "Google consent mode" handling

Created on 21 January 2021, almost 4 years ago
Updated 3 October 2024, about 2 months ago

It would be great if this module could accommodate the Google Consent mode (beta) directly as per the CivicUK blog post.

Following the example from that post, it should be as straightforward as:
1. Adding a checkbox in the admin dashboard to enable/disable "Google Consent mode".
2. Include documentation about the accompanying accept / revoke code that should be in the purpose categories.
3. If "Google Consent mode" is enabled, adding the following script as the very first script on the page:

  window.dataLayer = window.dataLayer || [];
    function gtag() {
      dataLayer.push(arguments);
    }

    // Default values for consent mode is 'denied'.
    gtag("consent", "default", {
      ad_storage: "denied",
      analytics_storage: "denied"
    });

A. Do the maintainers think this belongs in this module?
B. Does the approach above sound correct?

✨ Feature request
Status

Active

Version

4.3

Component

Code

Created by

πŸ‡ΏπŸ‡¦South Africa Gomez_in_the_South

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.

Production build 0.71.5 2024