mozilla-rally / rally-web-platform

Mozilla Public License 2.0
5 stars 5 forks source link

load analytics for every screen #612

Closed rhelmer closed 2 years ago

rhelmer commented 2 years ago

Fixes #603

rhelmer commented 2 years ago

@aaga this isn't quite ready to land, but it is working to send a screen_view for every screen on stage AFAICT. This is what I think we need to do, wdyt?:

I think the places we might want to use analytics in the Svelte app are:

I think using analytics means we need to dynamically import firebase/analytics only when there's a window present (non-SSR) and initialize firebase only if it hasn't already happened.

I have an example of loading the checking to see if firebase is initialized, but I'm not sure if the load order in these different places is guaranteed in svelte, and if so what the order is. This needs to be resolved before this lands.