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

Commit 1f31303

Browse files
authored
Update google_codelab.js
1 parent 872cbcf commit 1f31303

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

codelab-elements/google-codelab/google_codelab.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ const CATEGORY_ATTR = 'category';
4646
/** @const {string} */
4747
const GAID_ATTR = 'codelab-gaid';
4848

49+
/** @const {string} */
50+
const GA4ID_ATTR = 'codelab-ga4id';
51+
4952
/** @const {string} */
5053
const CODELAB_ID_ATTR = 'codelab-id';
5154

@@ -297,6 +300,10 @@ class Codelab extends HTMLElement {
297300
if (gaid) {
298301
analytics.setAttribute(GAID_ATTR, gaid);
299302
}
303+
const ga4id = this.getAttribute(GA4ID_ATTR);
304+
if (ga4id) {
305+
analytics.setAttribute(GA4ID_ATTR, ga4id);
306+
}
300307
if (this.id_) {
301308
analytics.setAttribute(CODELAB_ID_ATTR, this.id_);
302309
}
@@ -686,7 +693,7 @@ class Codelab extends HTMLElement {
686693
this.currentSelectedStep = selected;
687694
this.firePageViewEvent();
688695

689-
// Set the focus on the new step after the animation is finished becasue it
696+
// Set the focus on the new step after the animation is finished because it
690697
// messes up the animation.
691698
clearTimeout(this.setFocusTimeoutId_);
692699
this.setFocusTimeoutId_ = setTimeout(() => {

0 commit comments

Comments
 (0)