imbolc / sapper-google-analytics

Google Analytics for Sapper (Svelte)
MIT License
34 stars 0 forks source link

Analytics javascript bundle loads twice on exported website #3

Open chuntley opened 4 years ago

chuntley commented 4 years ago

It seems that on an exported website the analytics javascript bundle loads twice. I'm assuming this is because it loads the SSR version first, then again the client version. Would it make more sense to ignore the SSR version of analytics and only load the bundle on onMount()?

imbolc commented 4 years ago

Do you mean crating the script tag dynamically? SSR version shouldn't send statistic now after #2

chuntley commented 4 years ago

Yes, based on the network information that I attached above that it loads the js?id=UA- bundle twice. First time initiated from the script tab, the second time from client... which looks like the client generated script tag.

begonaalvarezd commented 4 years ago

Maybe is related to this issue? https://github.com/sveltejs/sapper/issues/1124

chuntley commented 4 years ago

Looks related!