Page 1 of 1

PartyTown - google pagespeed optimization

Posted: Tue Jan 21, 2025 6:11 am
by mostakimvip06
When working on optimizing a website, we often spend a lot of time on optimizing and refactoring code, optimizing images, setting up the server, and any problems that the Google Pagespeed Insight tool shows us. The website finally gets a decent score and then comes the moment when the marketing department orders us to place external scripts needed for analytics, ads, or YT videos. It turns out that the score drops from 90 to 50 out of 100 points.

Contents
What is Web Workers?
What is Partytown and why is it worth using?
Browser Compatibility
Summary
The problem with the performance of a website is often related to scripts loaded by third parties, so-called Third-Party Javascript. These are most often tools:

Facebook scripts (FB Pixel, Messenger chat),
analytical and measurement scripts (Google Tag Manager, Google Analytics),
advertising iframes or videos,
customer service chats on the site.
As we know, external scripts provide a wide range of useful functions and data. Thanks to them, we can analyze user behavior, display ads, and optimize activities on the site.

Tool to optimize loading of external scripts - PartyTown
What is Web Workers?
The term Web Workers is new, available in HTML5 API. It allows developers to run resource-intensive (page-heavy) Javascript parts in a separate thread. Thanks to this solution, when the page is run on the client computer, the user interface is not blocked.

What is Partytown and why is it worth using?
Partytown is a lazy-loaded library that helps move resource-intensive scripts to a web worker instead of calling them on the main thread. Its goal is to speed up pages by leaving only the code necessary to run the page on the main thread, the rest is delegated to the web worker.

The library is hosted by Builder.io

Benefits of Using PartyTown
As we can see in the image above, the main thread is much more important than armenia telemarketing data third-party scripts. This means that the main thread can perform activities related to the business logic of your application or website.

Browser Compatibility
PartyTown is currently in beta. This means that it is still being worked on. It supports browsers that support Atomics web workers, service workers . If you use the library on your website or application and you are worried about supporting older browsers, you are doing it unnecessarily, because on browsers that do not have support it works in the traditional way, i.e. as without using PartyTown.


Summary
Partytown is a very interesting tool for optimizing external scripts. After all, thanks to this library we load the main browser thread. Its creator - Builder.io created the Qwik framework, which works great with Partytown. You will learn more about it in Mateusz's article.

Creating in this technology significantly improves performance measured in PageSpeed ​​Insight. Web Vitals parameters such as TBT or TTI have dropped significantly and the site achieves results close to 100 points.

Web Developer at the marketing agency RekinySukcesu.pl
Pawel Tyrpula
Web Developer, working in the profession for 10 years. He graduated from the first and second degree of computer science studies at the Wrocław University of Science and Technology with a specialization in Application of Specialized Information Technologies (ZSTI). A motoring enthusiast, who is responsible, among others, for the IT support of events organized by the Auto Moto Klub Kłodzko community, thanks to which he combines work with passion. This is our IT specialist !
Read also
INP - New Core Web Vitals - Important Changes to Core Web Vitals
Core Web Vitals as factors influencing positioning and more
Page Load Speed ​​and E-Commerce
Success Story - Case Study
What is microdata?