<script lang="ts">
// import { page } from '$app/stores'

export let site_google_tracking_id: string = '';
console.log(`site_google_tracking_id = `, site_google_tracking_id);

if (typeof window !== 'undefined') {
    window.dataLayer = window.dataLayer || [];
    window.gtag = function gtag(): void {
        window.dataLayer.push(arguments);
    };
    window.gtag('js', new Date());
    window.gtag('config', site_google_tracking_id);
}

// $: if (typeof gtag !== 'undefined') {
//     gtag('config', site_google_tracking_id, {
//         page_title: document.title,
//         page_path: $page.url.pathname,
//     })
// }
</script>

<svelte:head>
<script
    async
    src="https://www.googletagmanager.com/gtag/js?id={site_google_tracking_id}">
</script>
<!-- <script>
    window.dataLayer = window.dataLayer || []

    function gtag() {
    dataLayer.push(arguments)
    }

    gtag('js', new Date())
    gtag('config', site_google_tracking_id)
</script> -->
</svelte:head>
