Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Load third party JS using async #444

Closed
thabti opened this issue Aug 11, 2016 · 6 comments
Closed

Load third party JS using async #444

thabti opened this issue Aug 11, 2016 · 6 comments

Comments

@thabti
Copy link
Contributor

thabti commented Aug 11, 2016

I ran webpagetest[1] against the website and we have some things to improve around time to first byte.

screen shot 2016-08-11 at 08 18 36

<script src="https://cdn.ravenjs.com/3.0.4/raven.min.js" async ></script>

1.https://www.webpagetest.org/result/160811_AY_9BP/

@ahmedre
Copy link
Contributor

ahmedre commented Aug 11, 2016

for raven specifically, this looks like it may be tricky, since setting it to async means we don't get errors during loading.

see this for more details: getsentry/sentry-javascript#169

@thabti
Copy link
Contributor Author

thabti commented Aug 11, 2016

Yeah kinda felt that would be an issue, especially Google Analytics and Mixpanel.

Maybe we can bundle raven/mixpanel as part of our javascript, if anything to save on http calls.

@mmahalwy thoughts on bundling raven.

@mmahalwy
Copy link
Contributor

I am not sure if webpack has the ability to download/bundle unless we download them. I think we could load raven in sync but don't need mixpanel to be.

@mmahalwy
Copy link
Contributor

Okay seems that mixpanel and zendesk load their script via async. All that script we have is doing is adding their code.

@thabti
Copy link
Contributor Author

thabti commented Aug 13, 2016

@mmahalwy They're being downloaded before DOM is ready?

We can download the files locally and bundle them as part of our script.

@mmahalwy
Copy link
Contributor

no no i mean it's a script from them that embeds their script async

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants