I am trying to add various types of metrics into a Blazor web assembly application. The majority of analytics, such as GA, Insights, Clarity all utilise a JavaScript loaded on the main page of the site, or a header component.
Now adding the metrics script directly into the index.html would be an option, however the codebase is basically templated to new clients as docker images. Therefore it is not possible to just add the metrics JavaScript into the index.html as it would be the same for all client applications that are generated from the codebase.
I am fairly new to Blazor but in MVC, I would just read the metrics client ID out of a azure config setting supplied to the docker image and then inject this via razor into the layout page, as appropriate.
It does not seem possible to do this in Blazor and it would also seem that you cannot add this kind of razor markup into index.html so how would I get around this issue?
I have seen a topic here that suggests it is possible to inject JavaScript into the index.html, but what about injecting a variable onto the page?