Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
uw_fdsu_theme_resp
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_fdsu_theme_resp
Commits
9bc28195
Commit
9bc28195
authored
4 years ago
by
Igor Biki
Committed by
Eric Bremner
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
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
!20
ISTWCMS-4708: Adding google tag manager code snippets to template file.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
templates/page/html.html.twig
+4
-0
4 additions, 0 deletions
templates/page/html.html.twig
uw_fdsu_theme_resp.theme
+1
-0
1 addition, 0 deletions
uw_fdsu_theme_resp.theme
with
5 additions
and
0 deletions
templates/page/html.html.twig
+
4
−
0
View file @
9bc28195
...
@@ -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
}}
...
...
This diff is collapsed.
Click to expand it.
uw_fdsu_theme_resp.theme
+
1
−
0
View file @
9bc28195
...
@@ -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
();
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment