1<?php 2 3declare(strict_types=1); 4 5/** 6 * @var string $access_level 7 * @var string $tree_name 8 * @var string $GOOGLE_ANALYTICS_ID 9 */ 10?> 11<script async src="https://www.googletagmanager.com/gtag/js?id=<?= e($GOOGLE_ANALYTICS_ID ?? '') ?>"></script> 12<script> 13 window.dataLayer = window.dataLayer || []; 14 function gtag(){dataLayer.push(arguments);} 15 gtag('js', new Date()); 16 gtag('config', <?= json_encode($GOOGLE_ANALYTICS_ID, JSON_THROW_ON_ERROR) ?>, { 17 'custom_map': {'dimension1': 'tree_name', 'dimension2': 'access_level'}, 18 'tree_name': <?= json_encode($tree_name, JSON_THROW_ON_ERROR) ?>, 19 'access_level': <?= json_encode($access_level, JSON_THROW_ON_ERROR) ?>, 20 }); 21</script> 22