Skip to content
Snippets Groups Projects
Commit 9bc28195 authored by Igor Biki's avatar Igor Biki Committed by Eric Bremner
Browse files

ISTWCMS-4708 Using service to include/exclude GTM scripts on template level.

parent f7808664
No related branches found
No related tags found
1 merge request!20ISTWCMS-4708: Adding google tag manager code snippets to template file.
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html{{ html_attributes }} class="no-js"> <html{{ html_attributes }} class="no-js">
<head> <head>
{% if not uw_admin_page %}
<!-- Google Tag Manager --> <!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
...@@ -39,17 +40,20 @@ ...@@ -39,17 +40,20 @@
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-M9XLVF');</script> })(window,document,'script','dataLayer','GTM-M9XLVF');</script>
<!-- End Google Tag Manager --> <!-- End Google Tag Manager -->
{% endif %}
<head-placeholder token="{{ placeholder_token|raw }}"> <head-placeholder token="{{ placeholder_token|raw }}">
<title>{{ head_title|safe_join(' | ') }}</title> <title>{{ head_title|safe_join(' | ') }}</title>
<css-placeholder token="{{ placeholder_token|raw }}"> <css-placeholder token="{{ placeholder_token|raw }}">
<js-placeholder token="{{ placeholder_token|raw }}"> <js-placeholder token="{{ placeholder_token|raw }}">
</head> </head>
<body{{ attributes.addClass(body_classes) }}> <body{{ attributes.addClass(body_classes) }}>
{% if not uw_admin_page %}
<!-- Google Tag Manager (noscript) --> <!-- Google Tag Manager (noscript) -->
<noscript> <noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M9XLVF" height="0" width="0" style="display:none;visibility:hidden"></iframe> <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M9XLVF" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript> </noscript>
<!-- End Google Tag Manager (noscript) --> <!-- End Google Tag Manager (noscript) -->
{% endif %}
{% include '@components/skiplinks/skiplinks.twig' %} {% include '@components/skiplinks/skiplinks.twig' %}
{{ page_top }} {{ page_top }}
{{ page }} {{ page }}
......
...@@ -32,6 +32,7 @@ function uw_fdsu_theme_resp_preprocess_html(&$variables) { ...@@ -32,6 +32,7 @@ function uw_fdsu_theme_resp_preprocess_html(&$variables) {
// Adding the faculty colour class to the body. // Adding the faculty colour class to the body.
$variables['attributes']['class'][] = theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') ? theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') : 'org-default'; $variables['attributes']['class'][] = theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') ? theme_get_setting('wcms_colour_scheme', 'uw_fdsu_theme_resp') : 'org-default';
$variables['uw_admin_page'] = \Drupal::service('uw_cfg_common.uw_analytics')->administrationPage();
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment