Skip to main content

On most of the sites I'm running the Google analytics ID is appearing.  Therefore, tracking and capturing data.  All except one!

Discovering where Google ID and Google Tag ID were on a client's site... or not in this situation.  Yes that's correct, for some reason the analytics IDs aren't appearing.  Zip, zero... nothing.

Looking on this site, Google tag Manager positions the tag ID in the following lines of code

<link rel="stylesheet" media="all" href="/sites/default/files/css/css_G4ITzbTP975nnq8RraxB-6CK9bFsPJWsTm5sBtIPMqU.css?delta=0&amp;language=en&amp;theme=bales&amp;include=eJyNj1GOwzAIRC_k2EeKqE2QW2JcwJvN7Ru16U-1WvVnmDcagYBSXKDtCU4TF5XmwXZzXNMFDEMWxXS9D9Q9SstnUHR04NhVSNEsXIDRErEcZjLfuTb6CLPW7nbusymL3CoGHPPLHWPtXOE4kf4Kv2_OBRcY7IFEiHF2oESHfHKEK_yGn4qbpafGVcpgDAtkdEtbLYT-pvPjF8Wi0otsbfqvRNhQgR9pUIrI" />
<link rel="stylesheet" media="all" href="/sites/default/files/css/css_IWQEngTWxUSxnOhb5FT_9Boc0z5ai8sCiuWmBeeq_xI.css?delta=1&amp;language=en&amp;theme=bales&amp;include=eJyNj1GOwzAIRC_k2EeKqE2QW2JcwJvN7Ru16U-1WvVnmDcagYBSXKDtCU4TF5XmwXZzXNMFDEMWxXS9D9Q9SstnUHR04NhVSNEsXIDRErEcZjLfuTb6CLPW7nbusymL3CoGHPPLHWPtXOE4kf4Kv2_OBRcY7IFEiHF2oESHfHKEK_yGn4qbpafGVcpgDAtkdEtbLYT-pvPjF8Wi0otsbfqvRNhQgR9pUIrI" />

<script type="application/json" data-drupal-selector="drupal-settings-json">
{
  "path": {
    "baseUrl": "/",
    "scriptPath": null,
    "pathPrefix": "",
    "currentPath": "knowledge-hub",
    "currentPathIsAdmin": false,
    "isFront": true,
    "currentLanguage": "en"
  },
  "pluralDelimiter": "\u0003",
  "suppressDeprecationErrors": true,
  "ajaxPageState": {
    "libraries": "addtoany/addtoany.front,bales/global-scripts,bales/global-styling,eu_cookie_compliance/eu_cookie_compliance_default,facets/drupal.facets.dropdown-widget,facets/drupal.facets.general,google_tag/gtag,google_tag/gtag.ajax,system/base,views/views.module",
    "theme": "bales",
    "theme_token": null
  },
  "ajaxTrustedUrl": { "/knowledge-hub": true },
  "gtag": {
    "tagId": "UA-{ID-REFERENCE}",
    "otherIds": ["G-{ID-REFERENCE}", "GT-{ID-REFERENCE}"],
    "events": [],
    "additionalConfigInfo": []
  },
  "eu_cookie_compliance": {
    "cookie_policy_version": "1.0.0",
    "popup_enabled": true,
    "popup_agreed_enabled": false,
    "popup_hide_agreed": false,
    "popup_clicking_confirmation": false,
    "popup_scrolling_confirmation": false,
    "popup_html_info": "\u003Cdiv aria-labelledby=\u0022popup-text\u0022  class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--opt-in\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info eu-cookie-compliance-content\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022 class=\u0022eu-cookie-compliance-message\u0022 role=\u0022document\u0022\u003E\n      \u003Ch2\u003EWe use cookies on this site to enhance your user experience.\u003C/h2\u003E\n\u003Cp\u003EBy clicking the Accept button, you agree to us doing so.\u003C/p\u003E\n\n          \u003C/div\u003E\n\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-secondary-button\u0022\u003EAccept\u003C/button\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022decline-button eu-cookie-compliance-default-button\u0022\u003ENo, thanks\u003C/button\u003E\n          \u003C/div\u003E\n  \u003C/div\u003E\n\u003C/div\u003E",
    "use_mobile_message": false,
    "mobile_popup_html_info": "\u003Cdiv aria-labelledby=\u0022popup-text\u0022  class=\u0022eu-cookie-compliance-banner eu-cookie-compliance-banner-info eu-cookie-compliance-banner--opt-in\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info eu-cookie-compliance-content\u0022\u003E\n        \u003Cdiv id=\u0022popup-text\u0022 class=\u0022eu-cookie-compliance-message\u0022 role=\u0022document\u0022\u003E\n      \n          \u003C/div\u003E\n\n    \n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-buttons\u0022\u003E\n            \u003Cbutton type=\u0022button\u0022 class=\u0022agree-button eu-cookie-compliance-secondary-button\u0022\u003EAccept\u003C/button\u003E\n              \u003Cbutton type=\u0022button\u0022 class=\u0022decline-button eu-cookie-compliance-default-button\u0022\u003ENo, thanks\u003C/button\u003E\n          \u003C/div\u003E\n  \u003C/div\u003E\n\u003C/div\u003E",
    "mobile_breakpoint": 768,
    "popup_html_agreed": false,
    "popup_use_bare_css": false,
    "popup_height": "auto",
    "popup_width": "100%",
    "popup_delay": 1000,
    "popup_link": "/",
    "popup_link_new_window": true,
    "popup_position": false,
    "fixed_top_position": true,
    "popup_language": "en",
    "store_consent": true,
    "better_support_for_screen_readers": false,
    "cookie_name": "",
    "reload_page": false,
    "domain": "",
    "domain_all_sites": false,
    "popup_eu_only": false,
    "popup_eu_only_js": false,
    "cookie_lifetime": 100,
    "cookie_session": 0,
    "set_cookie_session_zero_on_disagree": 0,
    "disagree_do_not_show_popup": false,
    "method": "opt_in",
    "automatic_cookies_removal": true,
    "allowed_cookies": "",
    "withdraw_markup": "\u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-tab\u0022\u003EPrivacy settings\u003C/button\u003E\n\u003Cdiv aria-labelledby=\u0022popup-text\u0022 class=\u0022eu-cookie-withdraw-banner\u0022\u003E\n  \u003Cdiv class=\u0022popup-content info eu-cookie-compliance-content\u0022\u003E\n    \u003Cdiv id=\u0022popup-text\u0022 class=\u0022eu-cookie-compliance-message\u0022 role=\u0022document\u0022\u003E\n      \u003Ch2\u003EWe use cookies on this site to enhance your user experience.\u003C/h2\u003E\n\u003Cp\u003EYou have given your consent for us to set cookies.\u003C/p\u003E\n\n    \u003C/div\u003E\n    \u003Cdiv id=\u0022popup-buttons\u0022 class=\u0022eu-cookie-compliance-buttons\u0022\u003E\n      \u003Cbutton type=\u0022button\u0022 class=\u0022eu-cookie-withdraw-button \u0022\u003EWithdraw consent\u003C/button\u003E\n    \u003C/div\u003E\n  \u003C/div\u003E\n\u003C/div\u003E",
    "withdraw_enabled": false,
    "reload_options": 0,
    "reload_routes_list": "",
    "withdraw_button_on_info_popup": false,
    "cookie_categories": [],
    "cookie_categories_details": [],
    "enable_save_preferences_button": true,
    "cookie_value_disagreed": "0",
    "cookie_value_agreed_show_thank_you": "1",
    "cookie_value_agreed": "2",
    "containing_element": "body",
    "settings_tab_enabled": false,
    "olivero_primary_button_classes": "",
    "olivero_secondary_button_classes": "",
    "close_button_action": "close_banner",
    "open_by_default": true,
    "modules_allow_popup": true,
    "hide_the_banner": false,
    "geoip_match": true
  },
  "facets": {
    "dropdown_widget": {
      "knowledge_tags": { "facet-default-option-label": "Tags" }
    }
  }
}
</script>

 

In the code dump above exists the following text

"gtag":{"tagId":"UA-{ID-REFERENCE}","otherIds":["G-{ID-REFERENCE}","GT-{ID-REFERENCE}"]

 

Whereas, on the site with the missing Google reference, it's appearing as

<script type="application/json" data-drupal-selector="drupal-settings-json">
{
  "path": {
    "baseUrl": "/",
    "scriptPath": null,
    "pathPrefix": "",
    "currentPath": "node",
    "currentPathIsAdmin": false,
    "isFront": true,
    "currentLanguage": "en"
  },
  "pluralDelimiter": "\u0003",
  "suppressDeprecationErrors": true,
  "ajaxPageState": {
    "libraries": "admin_toolbar/toolbar.tree,admin_toolbar/toolbar.tree.hoverintent,admin_toolbar_search/search,admin_toolbar_tools/toolbar.icon,contextual/drupal.contextual-links,contextual/drupal.contextual-toolbar,core/drupal.active-link,devel/devel-toolbar,{theme}/fonts,{theme}/global-scripts,{theme}/global-styling,shortcut/drupal.shortcut,system/base,toolbar/toolbar,toolbar/toolbar.escapeAdmin,tour/tour,user/drupal.user.icons",
    "theme": "{theme}",
    "theme_token": null
  },
  "ajaxTrustedUrl": [],
  "toolbar": {
    "breakpoints": {
      "toolbar.narrow": "only screen and (min-width: 16.5em)",
      "toolbar.standard": "only screen and (min-width: 38.125em)",
      "toolbar.wide": "only screen and (min-width: 61em)"
    },
    "subtreesHash": "_t3dUhxipIt1v7N4nvfxGeuK4APH8xqMwY1AbmapV0I"
  },
  "adminToolbarSearch": { "loadExtraLinks": true }
}
</script>

 

Related articles

Andrew Fletcher04 Apr 2025
Managing .gitignore changes
When working with Git, the .gitignore file plays a critical role in controlling which files and folders are tracked by version control. Yet, many developers are unsure when changes to .gitignore take effect and how to manage files that are already being tracked. This uncertainty can lead to...
Andrew Fletcher26 Mar 2025
How to fix the ‘Undefined function t’ error in Drupal 10 or 11 code
Upgrading to Drupal 10.4+ you might have noticed a warning in their code editor stating “Undefined function ‘t’”. While Drupal’s `t()` function remains valid in procedural code, some language analysis tools — such as Intelephense — do not automatically recognise Drupal’s global functions. This...
Andrew Fletcher17 Mar 2025
Upgrading to PHP 8.4 challenges with Drupal contrib modules
The upgrade from PHP 8.3.14 to PHP 8.4.4 presents challenges for Drupal 10.4 websites, particularly when dealing with contributed modules. While Drupal core operates seamlessly, various contrib modules have not yet been updated to accommodate changes introduced in PHP 8.4.x. This has resulted in...