FID or First Input Delay is one of the most important criteria presented in the Google core web vitals update.

This measure expresses the time that the website needs for its first interaction with the user. In simpler terms, you as a user click on a specific element of the site and the site provides you with what you asked for with a time difference. This time interval between your request and the response is analyzed as FID for Google.

The shorter the response time, the better the user experience of interacting with your website, and this is exactly what Google wants.

Before starting work, I ask you to check your FID score using the GTmetrix site. For a better understanding of FID, my suggestion is to read the number reported under TBT or Total Blocking Time, which you can see in the performance section of the Gtmetrix website.

The main reason for the weakness of FID is the heavy execution of JavaScripts, and you should significantly reduce your FID by postponing additional JavaScripts, compressing JS files, shortening long tasks, etc.

The topic that I want to present to you in this series of SEO training articles is the review of FID optimization methods and methods in a completely practical way, so I recommend you if you are looking for FID optimization, TBT time reduction, or JavaScript optimization. If you are visiting the site, be sure to read the rest of this article.

Importance of FID

FID is a metric that focuses only on interactions that are not continuous, such as clicking, etc., and tasks such as scrolling, zooming, etc., because they can be executed on another thread, are not considered by this metric.

FID optimization

As mentioned at the beginning of this article. JavaScript is one of the most important reasons for increasing the TBT time and directly decreasing the FID of your site.

When JavaScript is running, the browser is not able to respond to the user’s requests, or in other words, when the site is running JS files, it cannot respond to the user’s interactions well, and this is reflected in the time delay in the request execution.

Among the things you can do to fix this issue, the following can be mentioned:

  • Shorten long tasks
  • Optimizing the site for better interaction
  • Using web worker
  • Reduce JavaScript execution time

Shorten long tasks

If you want to reduce the size and amount of JavaScript that is used in loading a page, breaking tasks and long codes into smaller codes can significantly affect the TBT time.


Long tasks are those JavaScripts that users encounter when requesting a page with their failure to load quickly, and practically, due to the absence of a proper user interface, they will not get a proper user experience.

Any code that blocks the main thread for 50 milliseconds or more is known as a long task, and the webmaster or SEO expert must identify them and divide them into smaller tasks to reduce the delay in user login. This will improve your FID significantly.

Optimize your site for better engagement

Several reasons decrease the FID score as well as the TBT on our website. But the main culprit is none other than JavaScript!

First-party script execution

Improper code fragmentation, heavy code execution, etc. can directly affect TBT, FID, and TTI, so gradual loading of codes can significantly help improve user interactions with the site. It may seem like it’s the servers that are coloring the pixels on the screen for the user, but you should always be careful that the user interactions aren’t blocked by large scripts.

If you divide large codes by path. This will increase the speed of your site in a few milliseconds and some cases within a second.

Use of Web worker

Thread blocking is one of the main reasons for the delay in website interaction with the user. Web workers can solve this issue by running JavaScript in the background. By transferring independent operations from the user interface to a separate web worker, the blocking time of the main thread can be reduced and the FID can be significantly improved.

Consider using the following libraries to make Webworkers easier to use:

  • Comlink
  • Workway
  • Worker

Reducing the execution time of JavaScript codes

Reducing JavaScript codes and also optimizing codes on a page logically increases the speed of code execution and helps to improve your user experience.

There are two basic ways to reduce and optimize JS codes:

Defer unnecessary codes

All javascript codes are render-blocking by default. When the browser encounters a JavaScript tag, it stops, loads the file, and executes it after parsing. For the process to be done in the shortest possible time, it is necessary to avoid putting unnecessary codes.

You have two ways to shorten or disable unnecessary JavaScript codes:

  • Code-splitting is usually referred to as lazy-loading.
  • Defer or async unnecessary scripts

(It should be noted that all third-party scripts must be loaded with defer and async by default.)

Minimize unnecessary polyfills

If you have used the modern syntax of JavaScript as well as the API of new browsers for your coding, you need to transpile to work on old browsers, which includes polyfills. One of the problems that this transpiring and using polyfills creates for us is that new browsers will no longer download it (if they don’t need it). To reduce the size of your JavaScript, avoid polyfills as much as possible and use Limit it to the environments you need it for.

Optimization of polyfills

If you use Babel as a transpiler, use babel-preset-env for required browsers. Also, enable the bugfixes option for babel7.9 to remove unnecessary polyfills.

Use the following modules:

<script type=”module” src=”modern.js”></script>

<script module src=”legacy.js” defer></script>

Many of the newer ECMAScript features introduced through Babel are supported in environments that support JavaScript modules. So by doing this, it simplifies the process of checking and making sure that only the transpiled code is compiled for the browsers that need it.

FID check

Although lighthouse 6.0, as one of the best tools for checking core web vitals criteria, does not have a separate metric called FID, you can check and optimize your FID by checking your TBT time, which was also mentioned at the beginning of the article.

I hope you have benefited from reading this article. Dear ones, you can also ask us your questions in the field of optimization of core web vitals criteria.

Leave a Reply

Your email address will not be published. Required fields are marked *