xref: /webtrees/resources/views/modules/google-analytics/snippet.phtml (revision f9f6fffde9a4ddea74e52e0f4c13cde4ec13f3a4)
1<?php
2
3declare(strict_types=1);
4
5/**
6 * @var object $dimensions
7 * @var string $GOOGLE_ANALYTICS_ID
8 */
9
10assert(is_object($dimensions))
11
12?>
13<script async src="https://www.google-analytics.com/analytics.js"></script>
14<script>
15    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};
16    ga.l=+new Date;
17    ga("create", "<?=  e($GOOGLE_ANALYTICS_ID ?? '') ?>", "auto");
18    ga("send", "pageview", <?= json_encode($dimensions, JSON_THROW_ON_ERROR) ?>);
19</script>
20