Multiple containers don't load

Created on 25 July 2023, almost 2 years ago

Problem/Motivation

When configured to "Allow multiple Tag Containers" only the first container will ever be loaded.

Steps to reproduce

  1. Install like normal
  2. Go to the advanced settings: /admin/config/services/google-tag/settings and check the box to "Allow multiple Tag Containers"
  3. Configured at least 2 containers on /admin/config/services/google-tag/containers
  4. View the page source on the home page
  5. Observer only the first container ID is loaded.

Proposed resolution

Load all containers based on appropriate conditions.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States pookmish

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

Merge Requests

Comments & Activities

  • Issue created by @pookmish
  • 🇺🇸United States pookmish

    Looks like this starts at the container resolver and then issues propagate out to all the hooks. This likely will require some extensive refactoring.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update almost 2 years ago
    48 pass, 2 fail
  • @pookmish opened merge request.
  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸

    One use case for multiple containers:

    We have a distribution that manages configuration for 1000's of sites, and do not want to override our core distro config just to add an additional container for our clients that have them, because that adds significant service, support and maintenance overhead.

  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸
  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States joegraduate Arizona, USA
  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States japerry KVUO

    Fair enough use case indeed -- however tests are failing so moving to needs work until that issue can be uncovered.

  • 🇺🇸United States jeffreysmattson

    This patch wont apply to current 2.0.x-dev version. When viewing the MR the page throws an error and comments and MR not viewable. How do we move forward with this?

  • Status changed to Needs review about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    48 pass, 2 fail
  • 🇮🇳India chaitanyadessai Goa

    Please review Patch

  • The last submitted patch, 9: 3376960-9.patch, failed testing. View results
    - codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    48 pass, 2 fail
  • First commit to issue fork.
  • Pipeline finished with Failed
    11 months ago
    Total: 189s
    #190289
  • 🇺🇸United States majorrobot

    @chaitanyadessai's patch seems to be a reroll of !54, so I applied that locally.

    I found that the code did not load multiple gtag script tags correctly. Multiple tags loaded, but each tag repeated the config of the first tag (except for that the tagId). This gave a 404 for those tags.

    To resolve this, I took the pattern from google_tag_page_top() and refactored google_tag_page_attachments() accordingly.

    gtm.js also needed to account for multiple tag configs, so I also refactored parts of that file.

    Since MR !54 was out of date, I took the MR's branch and rebased on 2.0.x., then added my changes and pushed the new branch. I created MR !83. I'm not completely clear if this handles every case, but it should get us closer.

  • Status changed to Needs review 11 months ago
  • Pipeline finished with Failed
    11 months ago
    Total: 211s
    #190986
  • 🇺🇸United States theMusician

    Confirming this is still an issue in 2.0.5. Our use case is similar to trackleft2. We are able to work around this for now as we don't have many instances where we use multiple containers.

  • First commit to issue fork.
  • Pipeline finished with Failed
    5 months ago
    Total: 212s
    #359178
  • Version 2.0.7 with fixes in MR 83 shows multiple <iframe src="https://www.googletagmanager.com/ns.html?id=.... but <script src="https://www.googletagmanager.com/gtm.js?id= disappeared completely.

  • Pipeline finished with Failed
    2 months ago
    Total: 202s
    #434981
  • 🇺🇸United States majorrobot

    ^^ I rerolled again so the patch will apply. But I noticed, we're failing 3 PHPUnit tests now.

    I think we'll also need to update js/gtm.js so that there can be > 1 dataLayer name. Right now, everything is going into dataLayer.

    So, more work to be done, but patch works again.

  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸
  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸

    trackleft2 changed the visibility of the branch 3376960-multiple-containers-dont-2 to hidden.

  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸

    trackleft2 changed the visibility of the branch 3376960-multiple-containers-dont-2 to active.

  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸

    trackleft2 changed the visibility of the branch 2.0.x to hidden.

  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸

    trackleft2 changed the visibility of the branch 3376960-multiple-containers-dont to hidden.

  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸

    I've updated the merge request !83 to fix an outstanding bug in the patch that has to do with cache tag propagation.
    Additionally, I've updated the PHPUnit tests and Issue Summary to account for the API changes present in this MR.

    I think that I would suggest releasing this in a major or minor version bump.

Production build 0.71.5 2024