---
import { GoogleAnalytics } from '../../config'

const ID = GoogleAnalytics.id
---

{
    GoogleAnalytics.enable && (
        <script is:inline type="text/partytown" src=`https://www.googletagmanager.com/gtag/js?id=${ID}`></script>
        <script is:inline define:vars={{ ID }}>
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());
            gtag('config', ID);
        </script>
    )
}

