Top Viewed


Related articles

Rate Your Experience

Everything you need to know about Script Execution optimization

Modified on: Mon, 29 Jan, 2024

Scripts are one of the main parts of a website that slow down the loading of a page, however they are important for implementing all sorts of functionality on a website. This is why it is essential to optimize scripts to improve page load times.


Leap provides several features that can help you achieve this within the Leap dashboard > Optimize > Optimization settings > Script execution

image

Within this category there are several advanced settings to help optimize scripts:

image


Script Delay - Delays the loading and execution of Javascript until the primary content has loaded, this helps to prioritize the loading of the content improving LCP.

  • Do NOT delay scripts marked with no-defer parameters - prevents scripts marked with no-defer parameters such as 'data-cfasync' and 'data-pagespeed-no-defer.' from being delayed, helps to prevent unwanted delays that can break functionality or slow the site loading down. You can find information on how to implement no-defer parameters here.


Reduce CPU Intensive Tasks - Slows down javascript tasks that are using up too much CPU so the browser's processor has free time to render the page to improve LCP. This setting may affect the timing of SetInterval and SetTimeout calls.


Disable Ads Above The Fold - Above the fold is the content that a viewer sees before they scroll down the page. This feature tries to improve page performance and Core Web Vitals (FID, LCP) by removing ads above the fold. Can risk decreasing your revenue as these ad locations are usually the higher earning locations so only enable as a last resort.


jQuery Loading Method - jQuery is a Javascript library used by many web technologies, loading this library takes time so we attempt to optimize this in one of 2 ways:

  • Core jQuery Feature Preload - If excluding scripts that require jQuery functions, instead of also excluding the whole jQuery library, add a tiny script that enables core functionality until the main jQuery file is loaded
  • Load jQuery from CDN - Load jQuery from a global CDN so more users have it cached.


Common issues

Script delay can cause some issue with the following functionality:

  • Menus
  • Searchbars
  • Page layout
  • Image loading
  • Forms and other custom functionality


Conflicting technologies

There are some technologies that make optimizing your site with script delay difficult:

  • Page Builders such as Elementor and WPBakery are completely incompatible with script delay and this will need to be disabled.
  • Some themes such as Kadence, Astra, etc will require lots of script exclusions for your site to function correctly.
  • Speed optimization tools such as Perfmatters, WP Rocket, etc


Loading ...