diff --git a/lms/templates/body-extra.html b/lms/templates/body-extra.html
index 341a00b..99f2b30 100644
--- a/lms/templates/body-extra.html
+++ b/lms/templates/body-extra.html
@@ -2,6 +2,8 @@
<%! import hmac %>
<%! import hashlib %>
+<%include file="partials/analytics.html" />
+
## Renders when Cookie Banner is disabled or when it is enabled and user has dismissed (accepted) it:
% if (not get_global_settings().get('cookie_notification_enabled', False)) or (get_global_settings().get('cookie_notification_enabled', False) and (request.COOKIES.get('cookieconsent_status', '') == 'dismiss')):
@@ -51,16 +53,4 @@
% endif
- <%! from openedx.core.djangolib.js_utils import js_escaped_string %>
- <%
- customer_gtm_id = get_global_settings().get('customer_gtm_id')
- %>
-
- % if customer_gtm_id:
-
-
-
- % endif
-
% endif
diff --git a/lms/templates/head-extra.html b/lms/templates/head-extra.html
index 58eed30..2268a7d 100644
--- a/lms/templates/head-extra.html
+++ b/lms/templates/head-extra.html
@@ -48,7 +48,6 @@
% endif
-<%include file="partials/analytics.html" />
% if get_global_settings().get('default_additional_site_head_content', ''):
${get_global_settings().get('default_additional_site_head_content')}
@@ -57,36 +56,6 @@
## Renders when Cookie Banner is disabled or when it is enabled and user has dismissed (accepted) it:
% if (not get_global_settings().get('cookie_notification_enabled', False)) or (get_global_settings().get('cookie_notification_enabled', False) and (request.COOKIES.get('cookieconsent_status', '') == 'dismiss')):
- <%
- appsembler_ga_code = get_global_settings().get('appsembler_ga_code', '');
- client_ga_code = get_global_settings().get('client_ga_code', '');
- client_ga_enabled = get_global_settings().get('client_ga_enabled', True);
- client_ga_version = get_global_settings().get('client_ga_version', 'v3');
- %>
- % if SHOW_GOOGLE_ANALYTICS:
- % if client_ga_code and client_ga_enabled:
- ## for now Appsembler is still using v3 Universal Analytics and some customers do too.
- ## once Appsembler and all customers shift to v4 we remove this condition
- % if client_ga_version == 'v4':
-
-
-
- % else:
-
- % endif
- % endif
-
- % endif
-
% if get_global_settings().get('cookie_accepted_additional_site_head_content', ''):
% if request.COOKIES.get('cookieconsent_status', '') == 'dismiss':
${get_global_settings().get('cookie_accepted_additional_site_head_content')}
diff --git a/lms/templates/partials/analytics.html b/lms/templates/partials/analytics.html
index 1390251..ab87db8 100644
--- a/lms/templates/partials/analytics.html
+++ b/lms/templates/partials/analytics.html
@@ -68,7 +68,7 @@
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
- };setTimeout(loadGTM.bind(null, window,document,'script','dataLayer','${customer_gtm_id | n, js_escaped_string}'), 3000);
+ };setTimeout(loadGTM.bind(null, window,document,'script','dataLayer','${customer_gtm_id | n, js_escaped_string}'), 1000);
% endif
@@ -97,6 +97,35 @@
Dimension3: Visited course name
Dimension4: LMS or Studio
-->
+ <%
+ appsembler_ga_code = get_global_settings().get('appsembler_ga_code', '');
+ client_ga_code = get_global_settings().get('client_ga_code', '');
+ client_ga_enabled = get_global_settings().get('client_ga_enabled', True);
+ client_ga_version = get_global_settings().get('client_ga_version', 'v3');
+ %>
+
+ % if SHOW_GOOGLE_ANALYTICS:
+ % if client_ga_code and client_ga_enabled:
+ ## for now Appsembler is still using v3 Universal Analytics and some customers do too.
+ ## once Appsembler and all customers shift to v4 we remove this condition
+ % if client_ga_version == 'v4':
+
+
+
+ % else:
+
+ % endif
+ % endif
+
+ % endif
<%
appsemblerLmsTrackingCode = get_global_settings().get('appsembler_lms_tracking_code')
@@ -119,4 +148,11 @@
% endif
-% endif
\ No newline at end of file
+% endif
+
+% if customer_gtm_id:
+
+
+
+% endif