Add html_tag to preconnect to googletagmanager.com

Created on 6 August 2020, about 5 years ago
Updated 30 November 2023, almost 2 years ago

As per Lighthouse reports, page loading time would benefit of preconnect to origins to establish early connection so when the script actually try to communicate to the origin, the connection is already set.

<link rel="preconnect" href="https://www.googletagmanager.com"/>

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France vbouchet

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.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7 updated deps
    last update almost 2 years ago
    1 pass
  • πŸ‡³πŸ‡±Netherlands maurice@atom

    I've made some alterations so the key is included, and used `use-credentials` for the crossorigin

  • πŸ‡ͺπŸ‡ΈSpain Bryan Toapanta

    Reroll of patch #4 for version 1.7.0

  • First commit to issue fork.
  • πŸ‡­πŸ‡ΊHungary Balu Ertl Budapest πŸ‡ͺπŸ‡Ί

    Hi All! Do you think adding this <link rel="preconnect" href="https://www.googletagmanager.com"/> HTML element is necessary or beneficial to the 2.x version of this module as well?

  • Here's a straightforward patch for 2.0.8 based on the previous patches.

    This patch sets crossorigin to its default; NOT to use-credentials as this seems to be only required for very specific cases. Maybe a more complete version allows controlling this for each tag from the admin interface?

  • πŸ‡―πŸ‡΅Japan ptmkenny

    Since the module has GitLab CI tests now, we need an MR, not a patch, because the CI tests are only run for MRs, not patches.

  • πŸ‡ΊπŸ‡ΈUnited States luke.leber Pennsylvania

    I'm not sure that a preconnect would help with LCP at all given the module loads the script async. Loading async removes the JS from the critical render path.

    The best thing that the Google Tag module can do to help with improving LCP is to inline the first party JS (or add the async or defer attribute) to it.

    Preconnecting to the third party that's already loading async won't help anything unless the LCP element is being loaded from tag manager -- which would be an even bigger problem πŸ˜….

Production build 0.71.5 2024