<?php

declare(strict_types=1);

/**
 * @var object $dimensions
 * @var string $GOOGLE_ANALYTICS_ID
 */

assert(is_object($dimensions))

?>
<script async src="https://www.google-analytics.com/analytics.js"></script>
<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};
    ga.l=+new Date;
    ga("create", "<?=  e($GOOGLE_ANALYTICS_ID ?? '') ?>", "auto");
    ga("send", "pageview", <?= json_encode($dimensions, JSON_THROW_ON_ERROR) ?>);
</script>
