Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit 0df4e0f

Browse files
authored
Update google_codelab_analytics.js
1 parent 4d5855f commit 0df4e0f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

codelab-elements/google-codelab-analytics/google_codelab_analytics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ class CodelabAnalytics extends HTMLElement {
512512
// First, set the GTAG data layer before pushing anything to it.
513513
window[CODELAB_DATA_LAYER] = window[CODELAB_DATA_LAYER] || [];
514514

515-
const firstScriptElement = document.getElementsByTagName('script')[0];
515+
const firstScriptElement = document.querySelector('script');
516516
const gtagScriptElement = /** @type {!HTMLScriptElement} */ (
517517
document.createElement('script'));
518518
gtagScriptElement.async = true;

0 commit comments

Comments
 (0)