Make iframe (noscript) optional

Created on 14 January 2020, over 5 years ago
Updated 30 October 2023, over 1 year ago

For using google_tag with a Consent Management Platform (CMP) you have to disable the iframe.

A separate option for this would be great to prevent dirty patches.

Thank in advance.

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

šŸ‡©šŸ‡ŖGermany jan kellermann

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

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

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7 updated deps
    last update over 1 year ago
    1 pass
  • Status changed to RTBC over 1 year ago
  • šŸ‡¬šŸ‡§United Kingdom John_B London (UK), Worthing (UK), Innsbruck (Tirol)

    Thank you. The above patch looks good, applies to current 8.x-1-dev and 8.x-1.6, and works after a cache clear. It it is not suitable for 8.x-2 branch.

  • šŸ‡¬šŸ‡§United Kingdom John_B London (UK), Worthing (UK), Innsbruck (Tirol)

    The above patch does not work on 8.x-1.7 as google_tag_update_8104() is now declared twice.

  • Status changed to Needs work about 1 year ago
  • šŸ‡¬šŸ‡§United Kingdom John_B London (UK), Worthing (UK), Innsbruck (Tirol)
  • šŸ‡¬šŸ‡§United Kingdom John_B London (UK), Worthing (UK), Innsbruck (Tirol)

    Reroll for 8.x-1.7, changing update function name, see #17.

  • Status changed to Needs review 9 months ago
  • šŸ‡¬šŸ‡§United Kingdom John_B London (UK), Worthing (UK), Innsbruck (Tirol)
  • Pipeline finished with Canceled
    4 months ago
    Total: 76s
    #376424
  • Pipeline finished with Failed
    4 months ago
    Total: 282s
    #376425
  • Pipeline finished with Failed
    4 months ago
    Total: 349s
    #376440
  • Pipeline finished with Success
    4 months ago
    Total: 299s
    #376447
  • šŸ‡©šŸ‡ŖGermany jan kellermann

    jan kellermann → changed the visibility of the branch 3106318-make-iframe-noscript-optional to hidden.

  • šŸ‡©šŸ‡ŖGermany jan kellermann

    I created MR for version 2.0.x incl. tests for disabling noscript with iframe.

    Please review and feedback.

  • šŸ‡¬šŸ‡§United Kingdom John_B London (UK), Worthing (UK), Innsbruck (Tirol)

    Thanks for that. I installed it and ran updb (a mistake, I should have uninstalled 1.7 first). So ran drush pmu google_tag, drush en google_tag.

    After that I saw an error 'google_tag_container entity missing'.

    At the same time my administrator role and all related permissions were deleted. I am not blaming this MR, especially as I had failed to uninstall google_tag 1.7 before proceeding, and I do not really know the cause, so have not set back to 'needs work'. Just now feeling too traumatized to test again.

  • šŸ‡©šŸ‡ŖGermany jan kellermann

    Happy holidays, thank you for testing! I'm sorry that you had so many problems. However, the errors described are not related to the code from the MR.

  • Status changed to RTBC about 2 months ago
  • šŸ‡©šŸ‡ŖGermany szeidler Berlin

    I tested the MR and it works great. Makes it possible to be compliant with CMP like Klaro

  • šŸ‡ŖšŸ‡øSpain melgar3d

    I’d like to confirm that this issue is still relevant in Drupal 10.3.14.

    When the google_tag_gtm_iframe theme hook is not implemented in the active theme, Drupal logs a warning:

    The theme hook google_tag_gtm_iframe was not found.

    While it doesn't break functionality, it pollutes the logs unnecessarily and causes confusion in production environments.

    Making the

    block optional via a setting in the admin UI (as this patch provides) would be very helpful — especially for sites using Consent Management Platforms (CMPs) that need to block all tracking methods, including fallback iframes. Thank you to everyone working on this — the patch and MR are much appreciated. Looking forward to this being included in a stable release!
  • Pipeline finished with Failed
    18 days ago
    Total: 395s
    #461439
  • šŸ‡ŖšŸ‡ØEcuador jwilson3

    The workaround in comment #12 no longer works. What worked for me was just implementing the google-tag-gtm-iframe.html.twig template file in my Drupal theme:

    {#
    /**
     * @file
     * Overrides the Google Tag Manager noscript fallback iframe.
     *
     * It is intentionally left blank because GTM tracking is unnecessary
     * and against GDPR best practices when JavaScript is disabled.
     */
    #}
    

    This is not ideal, but we're in a situation where we can easily patch the module with the MR here due to being on a shared Drupal multisite instance.

Production build 0.71.5 2024