Embed twitter timeline async performance

Hi all Twitter gives instructions here help dot twitter dot com/en/using-twitter/embed-twitter-feed for how to embed tweets on a web page =

When I use this snippet on my web page it works ok but Google’s page speed test pagespeed dot web dot dev tells me that the script https://platform.twitter dot com/_next/static/chunks/4.87a72bcd1cc186518122.js is having a big negative impact (blocking the main thread) on my page loading speed

w3schools dot com says

If the async attribute is set, the script is downloaded in parallel to parsing the page, and executed as soon as it is available. The parsing of the page is interrupted once the script is downloaded completely, and then the script is executed, before the parsing of the rest of the page continues.

Many site visitors are not interested in the twitter feed so is it possible to stop this twitter script interrupting the parsing of the page? Or could I have a button saying “click here to see the twitter feed” so that the twitter script only loads for people that want to see the twitter feed?

1 Like

stuff it in an iframe? Simplest solution i can think of…

Where are you placing the script tag?
Does placing it immediately before the closing body tag make any difference?

1 Like