From 0df4e0f2eccb6713ea3c155110f0554799da4e9e Mon Sep 17 00:00:00 2001 From: JasonCent <137332364+JasonCent@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:26:59 -0400 Subject: [PATCH] Update google_codelab_analytics.js --- .../google-codelab-analytics/google_codelab_analytics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codelab-elements/google-codelab-analytics/google_codelab_analytics.js b/codelab-elements/google-codelab-analytics/google_codelab_analytics.js index 5039acc4d..6a5e32365 100644 --- a/codelab-elements/google-codelab-analytics/google_codelab_analytics.js +++ b/codelab-elements/google-codelab-analytics/google_codelab_analytics.js @@ -512,7 +512,7 @@ class CodelabAnalytics extends HTMLElement { // First, set the GTAG data layer before pushing anything to it. window[CODELAB_DATA_LAYER] = window[CODELAB_DATA_LAYER] || []; - const firstScriptElement = document.getElementsByTagName('script')[0]; + const firstScriptElement = document.querySelector('script'); const gtagScriptElement = /** @type {!HTMLScriptElement} */ ( document.createElement('script')); gtagScriptElement.async = true;