After upgrading the google_tag module to version 1.7, the expected code snippets for embedding in the <head> and <body> of the site are no longer being added

Created on 21 November 2024, about 1 month ago

Problem/Motivation
After upgrading the google_tag module to version 1.7, the expected code snippets for embedding in the and of the site are no longer being added. Specifically, the following code snippets are missing after the update:
Code for :

Code for :

When the module was downgraded to version 1.6, the code snippets started working again.

Steps to Reproduce

  1. Update the google_tag module to version 1.7.
  2. Clear the site caches.
  3. Inspect the and of the page source.
  4. Observe that the expected code snippets are missing.
  5. Downgrade the google_tag module to version 1.6.
  6. Clear the caches again.
  7. Verify that the code snippets are now correctly embedded.
🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇮🇳India lomasr

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

Comments & Activities

  • Issue created by @lomasr
  • 🇮🇳India dev2.addweb

    Hi @lomasr, During release 1.7 they have mentioned related issue #3114467 🐛 'Negate' form value for condition plugins should be cast to boolean in validation. Closed: duplicate , I have resolved this issue by applying patch from issue #3114467 🐛 'Negate' form value for condition plugins should be cast to boolean in validation. Closed: duplicate .

  • 🇺🇸United States solotandem

    I appreciate that missing snippets is a problem. However, the claim that the module fails to do as intended has been made several times (a search of closed issues confirms this) and in each case the problem was NOT related to the code in this project, but to other causes like deployment steps or lack thereof. The most recent duplicate issue is 🐛 Google Tag 1.7 breaks analytics Needs work . I would draw your attention to comment #5.

    In my testing of the module upgrade to release 1.7, there has never been a failure to insert snippets on the page after the upgrade. My testing is done in a simple environment which tests the code in the module. Deployment steps that might cause a problem are outside the scope of this code. From your 'Steps to Reproduce', my testing indicates that all that needs to be done is #1 and #4 would confirm the presence of snippets. Again, my testing is done on a plain vanilla site without interference from deployment steps.

    If you can demonstrate this code is the cause of missing snippets, then please elaborate.

    The related issue mentioned in #2 has a further related issue 🐛 Adding or editing a block through the UI saves the entity twice Fixed which is marked fixed. Is that fix in the core release you are using?

  • 🇨🇦Canada kiwad

    I'm guessing that this is related to new field hostname that isnt set in previous versions but now in code there is :

          if (empty($hostname)) {
            // No hostname.
            return $satisfied[$this->id] = FALSE;
          }
    
    

    I would suggest having more something like this instead

    $hostname = empty($hostname) ? 'www.googletagmanager' : $hostname;

Production build 0.71.5 2024