Skip to content

Commit

Permalink
feat: Exchange Google tag manager script
Browse files Browse the repository at this point in the history
  • Loading branch information
mitelg committed Mar 7, 2024
1 parent 3b83b13 commit f5a0321
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 36 deletions.
2 changes: 0 additions & 2 deletions app/config/sculpin_site_prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
imports:
- sculpin_site.yml

google_tag_manager_id: GTM-WJKMNPS
34 changes: 17 additions & 17 deletions source/_layouts/default.twig.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<!doctype html>
<html class="no-js" lang="en">
<head>
<!-- Google Tag Manager -->
<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], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://sst.shopware.com/pmthrpcx.js?st=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'WJKMNPS');</script>
<!-- End Google Tag Manager -->

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

Expand Down Expand Up @@ -46,6 +57,12 @@
</head>

<body>
<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src="https://sst.shopware.com/ns.html?id=GTM-WJKMNPS" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->

<div class="wrapper">

<header class="header--main">
Expand Down Expand Up @@ -243,22 +260,5 @@ <h2>Version History</h2>

{% include 'usercentrics.twig' %}

{% if site.google_tag_manager_id %}
<!-- Google Tag Manager -->
<script type="text/plain" data-usercentrics="Google Tag Manager">(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],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src =
'//www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '{{site.google_tag_manager_id}}');</script>
<!-- End Google Tag Manager -->
{% endif %}

</body>
</html>
34 changes: 17 additions & 17 deletions source/_layouts/start.twig.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
<!doctype html>
<html class="no-js" lang="en">
<head>
<!-- Google Tag Manager -->
<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], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://sst.shopware.com/pmthrpcx.js?st=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'WJKMNPS');</script>
<!-- End Google Tag Manager -->

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

Expand Down Expand Up @@ -44,6 +55,12 @@
</head>

<body>
<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src="https://sst.shopware.com/ns.html?id=GTM-WJKMNPS" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->

<div class="wrapper">

<header class="header--main">
Expand Down Expand Up @@ -347,22 +364,5 @@ <h3>Latest changes</h3>

{% include 'usercentrics.twig' %}

{% if site.google_tag_manager_id %}
<!-- Google Tag Manager -->
<script type="text/plain" data-usercentrics="Google Tag Manager">(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],
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src =
'//www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '{{site.google_tag_manager_id}}');</script>
<!-- End Google Tag Manager -->
{% endif %}

</body>
</html>

0 comments on commit f5a0321

Please # to comment.