When a site has multiple layouts on a template, it can be hard to load only the scripts and styles us on that specific page. But you can improve some of the “remove unus JavaScript/CSS” line items by taking inventory of what’s actually being us . Maybe you have a JS library that you thought you ne but don’t. The same goes for plugins—really pare down the active plugins to only those you ne . Don’t use plugins for functionality that you can implement natively in your theme.
Objectively assess the length of your page.
If you are tagg with “Avoid DOM too large”, ask yourself, “Is there too much content on this page?” Many people think that large size means a very long page, which is one case. But it can also refer to a deep page or elements, such as nest galleries, sliders, accordions, etc. If you know you will ne a lot of sections down the page, try to keep their functionality minimal. If you ne intense interactive elements, consider placing them on the page where the main content is. It is difficult to r uce the size of the DOM once the site is cod , unless you can move the entire element to a different page. You really should keep this line item in mind during the design phase of your project.
Maintain your r irects.
If a resource URL has expir and must follow a r irect to its new location, it will slow down the process of loading all page elements. The most common trigger for avoiding multiple page r irects is having to r irect from http to https. Many plugins, and even some hosts, have options for forcing https before a page loads so that you can bypass the r irect altogether.
Take inventory of your tracking scripts.
Everything else you can do, your site’s page spe score will likely plummet after adding any tracking script (analytics, tag managers, conversion pixels, etc.). This happens because third-party scripts often fail most PageSpe Insights metrics. They r irect from one URL to another unnecessarily. They don’t minify or cache their resources. They load imm iately on the page instead of loading as ne . Ironically, Google’s own analytics JS has been flagg in their own testing, but you may be affecting files stor on a third-party CDN.