Do you use React? Let me give you an example of how I load and initialize the google analytics and you might think to do something similar. In your app JS (above the router), wait for everything to be up… 1 or 2 or 3 or 5 sec and then pull and initialize your Stripe
componentDidMount () {
setTimeout(() => {
import('react-ga')
.then(ReactGA => {
ReactGA.initialize('xxxxxx')
ReactGA.set({ page: window.location.pathname })
ReactGA.pageview(window.location.pathname)
history.listen((location, action) => {
ReactGA.set({ page: location.pathname })
ReactGA.pageview(location.pathname)
})
})
}, 1000)
}