Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Commit 7887c41

Browse files
author
stevebagwell
committed
Just use the old trackingId
1 parent ca24f65 commit 7887c41

File tree

1 file changed

+2
-36
lines changed

1 file changed

+2
-36
lines changed

themes/material/common-head-elements.php

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,21 @@
77

88
<?php
99
$trackingId = htmlentities($this->configuration->getValue('analytics.trackingId'));
10-
1110
if (! empty($trackingId)) {
12-
?>
13-
<script>
14-
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
15-
ga('create', '<?= $trackingId ?>', 'auto');
16-
ga('send', 'pageview');
17-
</script>
18-
<script async src='https://www.google-analytics.com/analytics.js'></script>
19-
<?php
20-
} else {
21-
?>
22-
<script>
23-
window.ga = function () {
24-
// Null object pattern to avoid `if (window.ga)` wherever ga is used.
25-
}
26-
</script>
27-
<?php
28-
}
29-
?>
30-
31-
<?php
32-
// This block of code is intended to replace the old window.ga code (above) once
33-
// the transition from Google's Universal Analytics to GA4 type projects has been completed
34-
$trackingIdGA4 = htmlentities($this->configuration->getValue('analytics.trackingIdGA4'));
35-
if (! empty($trackingIdGA4)) {
3611
?>
3712
<!-- Google tag (gtag.js) -->
38-
<script async src="https://www.googletagmanager.com/gtag/js?id=<?= $trackingIdGA4 ?>"></script>
13+
<script async src="https://www.googletagmanager.com/gtag/js?id=<?= $trackingId ?>"></script>
3914
<script>
4015
window.dataLayer = window.dataLayer || [];
4116
function gtag(){dataLayer.push(arguments);}
4217
gtag('js', new Date());
4318

44-
gtag('config', '<?= $trackingIdGA4 ?>');
45-
</script>
46-
<?php
47-
} else {
48-
?>
49-
<script>
50-
window.dataLayer = function () {
51-
// Null object pattern to avoid `if (window.dataLayer)` wherever dataLayer is used.
52-
}
19+
gtag('config', '<?= $trackingId ?>');
5320
</script>
5421
<?php
5522
}
5623
?>
5724

58-
5925
<?php
6026
$colors = htmlentities($this->configuration->getValue('theme.color-scheme') ?: 'indigo-purple');
6127
?>

0 commit comments

Comments
 (0)