<script lang="ts">
    let {
        domain,
        enabled = !import.meta.env.DEV,
    }: {
        domain: string
        enabled?: boolean
    } = $props()
</script>

<svelte:head>
    {#if enabled}
        <script defer data-domain={domain} src="https://analytics.flayks.com/js/{import.meta.env.DEV ? 'script.local.outbound-links' : 'script.outbound-links'}.js"></script>
        <script>
            window.plausible = window.plausible || function() {
                (window.plausible.q = window.plausible.q || []).push(arguments)
            }
        </script>
    {/if}
</svelte:head>
