Twitter embed JS - long JS execution during On Load

I work on a publishing site and we use Twitter embeds in a lot of articles (below the fold). Recently we added preconnect to hoping to improve pagespeed. It didn’t seem to have a massive impact, but every little bit counts and I’ve learned this is a best practice.

We have cut down the connection and download time of this script, however this long execution bar did not go away. It looks like it’s extending the time of the document onload.

Is this problematic for pagespeed, and if so what can we do given that we cannot modify this script?

Thanks in advance.

1 Like

Looks like a long onload handler. Not much you’re going to be able to do with it - that may be when it is filling in some of the embeds. Maybe something about how the embeds are implemented may be slow and could be worked around (timeline viewer should give you a better idea for what the script is doing).

The main impact it will have is the possibility of triggering a long First Input Delay (FID) if the user tries to interact with your site during onload.

1 Like