This repository was archived by the owner on Jun 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,16 @@ The login page looks for `/simplesamlphp/www/logo.png` which is **NOT** provided
3535
3636Update ` /simplesamlphp/config/config.php ` :
3737
38+ Google Analytics Project ID (currently Universal Analytics, but transitioning to GA4)
3839```
3940'analytics.trackingId' => 'UA-some-unique-id-for-your-site'
4041```
4142
43+ Temporary New Google Analytics 4
44+ ```
45+ 'analytics.trackingIdGA4' => 'G-some-unique-id-for-your-site'
46+ ```
47+
4248_ [ ssp-base] ( https://github.com/silinternational/ssp-base ) provides a convenience by loading this config with whatever is in the environment variable ` ANALYTICS_ID ` ._
4349
4450### Announcements
Original file line number Diff line number Diff line change 77
88<?php
99$ trackingId = htmlentities ($ this ->configuration ->getValue ('analytics.trackingId ' ));
10+ $ hasGATracking = false ;
11+
1012if (! empty ($ trackingId )) {
13+ $ hasGATracking = true ;
1114?>
1215 <script>
1316 window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
1619 </script>
1720 <script async src='https://www.google-analytics.com/analytics.js'></script>
1821<?php
19- } else {
22+ }
23+ ?>
24+
25+
26+ <?php
27+ // This block of code is intended to be temporary until the transition from
28+ // Google's Universal Analytics to GA4 type projects has been completed
29+ $ trackingIdGA4 = htmlentities ($ this ->configuration ->getValue ('analytics.trackingIdGA4 ' ));
30+ if (! empty ($ trackingIdGA4 )) {
31+ $ hasGATracking = true ;
32+ ?>
33+ <!-- Google tag (gtag.js) -->
34+ <script async src="https://www.googletagmanager.com/gtag/js?id=<?= $ trackingIdGA4 ?> "></script>
35+ <script>
36+ window.dataLayer = window.dataLayer || [];
37+ function gtag(){dataLayer.push(arguments);}
38+ gtag('js', new Date());
39+
40+ gtag('config', '<?= $ trackingIdGA4 ?> ');
41+ </script>
42+ <?php
43+ }
44+
45+ if (! $ hasGATracking ) {
2046?>
2147 <script>
2248 window.ga = function () {
You can’t perform that action at this time.
0 commit comments