You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1.3 KiB
25 lines
1.3 KiB
<?php if(GDPR['on']) { ?>
|
|
<!-- GA and GTag Manager -->
|
|
<script async src="https://www.googletagmanager.com/gtag/js?id=<?=GA4_TRACKER_ID?>" nonce="<?=$csp_nonce?>" <?=(GDPR['on'] ? GDPR['inline_src'] : '')?>></script>
|
|
<script nonce="<?=$csp_nonce?>" <?=(GDPR['on'] ? GDPR['inline_src'] : '')?>>
|
|
const GTM = "<?php echo GTAG_MANAGER?>", GATID = "<?php echo GA_TRACKER_ID?>", GAUID="<?php echo ($logged_in)?$logged_in["user_id"]:""?>";
|
|
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
})(window,document,'script','dataLayer',GTM);
|
|
|
|
/*Global site tag (gtag.js) - Google Analytics */
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
|
|
gtag('config', '<?=GA4_TRACKER_ID?>');
|
|
if (GAUID) {
|
|
gtag('set', 'userId', GAUID);
|
|
gtag('set', 'dimension1', GAUID);
|
|
gtag('set', 'dimension2', GAUID);
|
|
gtag('set', 'dimension4', GAUID);
|
|
}
|
|
</script>
|
|
<?php } ?>
|