latitude-dev / latitude

Developer-first embedded analytics

Home Page:https://latitude.so

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot add third party scripts to a latitude view

geclos opened this issue · comments

What the title says

The <svelte:head> does actually accept third-party script tags in it. The problem comes with our Vite script that we use to automatically configure the runQuery and params methods. This script needs to inject some code into a script tag in the DOM. To do this, since svelte only allows for one script tag for each file (except for those in the svelte:head tag), it looks for an already existing script tag and, if it doesn't find any, creates one.

The problem appears when adding scripts in that special svelte:head tag. It should work by itself, but then our script injects some code in them, which completely breaks it.