From 57438dc957bfb1f188e32c215e1b94646182ec12 Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Fri, 7 Jul 2023 10:49:36 -0700 Subject: [PATCH] Add a timeout delay prior to GTM init Address intermittent failure to load YouTube video module content Apparently only an issue when customer uses Google Analytics<4 with Measure videos turned on Following solution proposed in https://discuss.openedx.org/t/first-video-on-lesson-dont-work/3836/3B ENG-97 --- lms/templates/partials/analytics.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lms/templates/partials/analytics.html b/lms/templates/partials/analytics.html index 10d97314..23ca883e 100644 --- a/lms/templates/partials/analytics.html +++ b/lms/templates/partials/analytics.html @@ -60,12 +60,15 @@ }]; % endif + ## Add a timeout delay to GTM initialization to avoid breaking video module loading from YouTube + ## with Google Analytics v<4 with Measure Videos turneed on + ## see: https://discuss.openedx.org/t/first-video-on-lesson-dont-work/3836/3 - + };setTimeout(loadGTM.bind(null, window,document,'script','dataLayer','${customer_gtm_id | n, js_escaped_string}'), 1000); % endif