In my root +layout.svelte
file I have the following code:
<code><svelte:head>
{#if environment === "PRODUCTION"}
<script defer data-domain="mydomain.com" src="https://plausible.io/js/script.js"></script>
{/if}
</svelte:head>
</code>
<code><svelte:head>
{#if environment === "PRODUCTION"}
<script defer data-domain="mydomain.com" src="https://plausible.io/js/script.js"></script>
{/if}
</svelte:head>
</code>
<svelte:head>
{#if environment === "PRODUCTION"}
<script defer data-domain="mydomain.com" src="https://plausible.io/js/script.js"></script>
{/if}
</svelte:head>
This ends up twice in the web page. How can I make sure that this is not duplicated? Ideally I would just add this to my app.html
and not deal with svelte:head
, but since this should only be loaded on production, I need the flexibility of conditionals…
Because this script ends up being included twice, all events that we track get counted twice ????