ADDRESSING CORE WEB VITALS ISSUES
Core Web Vitals are a set of specific metrics that Google considers important in a webpage’s overall user experience. These metrics are crafted to assess the genuine user experience, encompassing loading performance, interactivity, and visual stability of a webpage.
Core Web Vitals metrics:
- First Input Delay – FID
- First Contentful Paint – FCP
- Largest Contentful Paint – LCP
- Cumulative Layout Shift – CLS
HOW TO IMPROVE FID SCORE?
- Clicking on a link or button
- Adding input text into a blank field
- Selecting a drop-down menu
- Clicking a checkbox
Here are key suggestions to enhance the FID score:
- Code-splitting
- Deferring JavaScript
- Removing unused JavaScript
- Delaying JavaScript execution
- Minifying JavaScript etc.
HOW TO IMPROVE FCP SCORE?
Here are some important
recommendations to improve the FCP score:
Ø
One issue that's particularly important for FCP is font load time.
Ensure text remains visible during webfont load.
Ø Avoid
showing invisible text. The easiest way to avoid showing invisible text while
custom fonts load is to temporarily show a system font. By
including font-display: swap in @font-face style.
Ø Reducing
initial server response time
Ø Avoiding
multiple page redirects
Ø Establishing
early connections to important third-party origins
Ø Use a Content Delivery Network (CDN)
Other recommendations:
Ø
Defer offscreen images - Deferring offscreen images (or
lazy-loading) refers to the practice of delaying the loading of images that
aren't in your visitors' viewport until they are needed.
Ø
Time to Interactive (TTI) and Speed Index (SI) may be improved by
implementing a lazy-loading strategy.
Ø
Serving static assets with an efficient cache policy helps improve
page load times on repeat visits by storing these files locally in the user's
browser.
Ø Preconnect to required origins - Using preconnect helps the browser prioritize important third-party connections and speeds up your page load as third-party requests may take a long time to process.
HOW TO IMPROVE LCP SCORE?
Following elements are considered for LCP -
HTML element, such as:
Ø
An image element
Ø
A video element
Ø
An element with the background image loaded via the URL function
(instead of declaring it in the CSS)
Ø
Block-level elements such as <h1>, <h2>, <div>,
<ul>, <table>, etc.
Here are some important
recommendations to improve the LCP score:
Ø
Eliminating render-blocking behavior. General
methods to Eliminate render-blocking resources.
ü
Move all <script> and <link> tags
to the bottom of your HTML code.
ü Add async or defer attributes.
Ø Optimizing images and videos - Optimize image
and video delivery on your page to reduce the time taken to load images and
videos. Some of the things you can do include:
ü Properly sizing images
ü Combining images using CSS sprites
ü Serving images in next-gen formats
Ø Combine images using CSS sprites - Combining
images using CSS sprites reduces the number of round-trip requests made, which
can yield performance gains for your page.
ü Ensure that your images are properly sized for your webpage and user's
viewport before combining them.
ü Combine your small images into a single image file using a CSS sprite
generator tool like cssspritetool.com.
ü Along with the combined image file, the tool will also provide CSS and
HTML code.
ü Add the CSS and HTML code to your webpage.
Ø Serve images in next-gen formats - Most
websites serve images in JPEG or PNG formats, which have been around since the
1990s. The availability of a new generation of image formats offers an
opportunity to further reduce your image file sizes.
ü WebP (most widely used and recommended format)
ü JPEG 2000
ü JPEG XR
Ø Reduce unused JavaScript
Example – Use
js minimizer plugin like UglifyJsPlugin
Ø Reduce unused CSS
Example – Use miniCssExtractPlugin and postcss plugin to optimize the css
HOW TO IMPROVE CLS SCORE?
Improve CLS score by incorporating
good practices into your development workflow, such as:
Ø Specifying
image dimensions - Always specify, both, width and height for your website's
image and video elements so that the correct spacing is used for
images/videos.
Alternatively,
you can use CSS aspect ratio boxes to do the same.
Ø Reducing
layout shifts caused by ads, embeds and iframes
To
reduce layout shifts caused by ads, embeds and iframes, do things like:
ü Reserve
ad slot size (preferably the largest) before loading the ad library.
ü Move
ads to the bottom or out of the viewport.
ü Use
placeholders when there is no ad available to show.
Ø Avoiding
inserting new content above existing content
ü Try and
avoid inserting dynamic content (e.g., banners, forms, etc.) above existing
content unless in response to user interaction. This helps prevent unexpected
layout shifts.
Ø Preventing
the Flash of Invisible Text (FOIT)
ü The Flash of Invisible Text (FOIT) issue can also affect your page's CLS. Ensure your text remains visible during webfont loads by preloading web-fonts and/or using the font-display attribute.
Comments
Post a Comment