faro-web-sdk
faro-web-sdk copied to clipboard
Investigate loading SDK without blocking page-load
What
We should investigate if we can load the SDK async without side-effects.
If we can and found no reason not to do it, we need to adjust docs an the in-app instructions in the App O11y plugin
Did some first rough tests.
Works fine with async anddefer attributes added.
Note 1: I struggled a bit with initializing the React Instrumentation that way but did not put too much time into it. So I need to double check this specific case. (Very likely a lot of the users, even if they have an spa, do not want to add any 3rd parties to their initial bundle and rather lazy load them later after delivery to the browser.)
Note 2:
The async attribute is sometimes added alongside the defer attribute as a fallback for older browsers which do not support defer. It's important to know that the execution order of scripts differ between the two. Defer keeps the relative order of scripts while async does not. Even that this shouldn't be any problem it needs to be double checked.
@codecapitano @cedricziel any action we can take on this? or has Marco's answer satisfied this ticket?