Embedded tweets take a toll on your website performances!

I just discovered after running Lighthouse on Mockoon's website (https://mockoon.com) that using Twitter embedded tweets is taking a huge toll on the website performances.

Here is the Lighthouse report: https://imgur.com/LlZWyXL

Over 50 HTTP requests, multiple JS files blocking the main thread for seconds, MB of data and resources, etc. (https://imgur.com/kyGetTj)

Did some of you had the same experience?

I am seriously thinking about ditching the embedded tweets completely or replace them with lightweight screenshots.

  1. 3

    For screenshots, I quick Google gave me http://themaninblue.com/experiment/screenshot-a-tweet/. I tried it out and it uses the banner of the author as background image. Pretty nice.

    1. 2

      Nice tool, I was looking for something like this, thanks.

  2. 2

    Yep, totally. I too was surprised - about 20+ requests per embedded tweet. Nuts.

    My product (https://markfolder.com) is all about bookmarking tweets, so you can imagine what's going to happen in folders with hundreds of embedded tweets!

    I'm going the same route as @yongfook, i.e. lazy load them as the user scrolls.


    1. 1

      Hi Ferez, are you using the Twitter API? If so, it could be worth using the text of the tweet as a preview when listing them, and then show the embed when viewing a specific tweet.

      I'm assuming there's pagination on those folders?

      I'm using the API in a product I've developed for people doing research, which allows the user to save both tweets and videos from YouTube, though I'm seeing good performance.

      1. 1

        I'm using just the open oEmbed API, so I'm already capturing the tweet and some basic info, so your idea is a good one. I'll explore this!

        Theundercloud looks like another great "second brain" app (I initially read it as "Thundercloud".

        1. 1

          Aye, the domain name fairies got there before me!

    2. 1

      Probably the best solution!
      I would also like to try generating light text/CSS versions with no dependencies.

      1. 1

        Yes definitely need to go with something lighter I think. Good stuff.

  3. 2

    I realised the same after embedding several tweets on my homepage - the first-paint performance tanked.

    Now I lazy-load the tweets. The page loads without them, then as the user scrolls down nearer the tweet section, they load. The initial page load is much faster now.

    You can see the lazy load in action on bannerbear.com

    I use Waypoints to detect when the user has scrolled near the tweet section:

    1. 1

      This is a nice approach, I would rather go for something simple, but I will have a look at this.

  4. 2

    Well, that's sort of obvious....request.

    You can do them with Html & CSS and then ylu are ready to go.

    It takes time, I know but I am sure you'll find the snippet somewhere.

    Oh, I did.

    Can I feature it on my newsletter? I mean mockoon.

    1. 1

      Nice, thanks for the resource!
      It would be an honor to have Mockoon featured in your newsletter!
      Do you need any materials, logo, screenshot?

      Thanks :)

      1. 1

        You are very welcome Guillaume!
        You can send some text, around 140 characters to [email protected]

        just like in these posts, under this text:
        APPS, TOOLS n’ SITES ―
        thanks a lot!

        1. 1

          Sent! Thank you :)

          1. 1

            Superb. I will answer back

  5. 2

    That's correct, performance will suffer.

    Another big problem is not only performance but also privacy. By embedding widgets (Twitter, Facebook), you expose your users to their tracking tools and theoretically you should also display and update your GDPR cookie banner because of it.

    1. 1

      +1 for the GDPR, that's even worse.
      But I wasn't expecting such shitty performances from such a widely used "tool".

  6. 2

    pretty much any embed is bad because of the additional network request you have to do.

    1. 1

      Sure, but I use other things like GA, or Github button, and it's nowhere as bad as Twitter megabytes of things just to display some text.

  7. 1

    You can put it inside an accordion and label it (Check X from Twitter).

  8. 1

    I can't see the embedded tweets on your page so it's not quite clear what you're doing. But you definitely shouldn't be doing the fetching from the front end while the page is loading.

    Much better would be to fetch them and store them either in your db or in memory on your server before any visitor has even requested the page. Then, when a request comes in, send all the tweet data to the front end along with everything else for the initial page render.

    1. 1

      I removed them for now.
      I cannot follow your approach, I don't use Twitter API but their tweet embedding tool, which is some HTML/CSS and a JS script. Also it's a static website, so no DB or backend. But delaying the load when user scroll is an idea I will explore.

  9. 1

    This comment was deleted 9 months ago.

    1. 1

      I agree, the ditching is temporary :)
      But here it was not an extra second, it was a lot more.

Trending on Indie Hackers
Rejected from YC 15 comments 29 days left before 2022 🔥 What do you want to finish & accomplish before the end of the year? 11 comments People found our landing page confusing. 4 comments Bootstrapping a SaaS that uses AI to explain code in plain English 4 comments Live Below Your Means for Freedom 2 comments A decade worth of bootstrapping a SaaS in the PR industry - AMA 2 comments