chevron_right
chevron_right
Optimizing scripts with Leap
Informational/Resource

Optimizing scripts with Leap

Last Updated a month ago
Article Navigation
Introduction
Overview

Introduction

Scripts play a crucial role in the functionality of a website, but they can also significantly slow down page loading times. Optimizing script execution is essential for improving overall site performance and user experience. This article will provide detailed information on how you can leverage various features within the Leap dashboard to optimize script execution. You will learn about advanced settings such as Script Delay, Reduce CPU Intensive Tasks, and jQuery Loading Method, as well as how to handle common issues and conflicting technologies. By the end of this article, you will have a comprehensive understanding of how to enhance your website's speed and efficiency through effective script optimization.

Overview

Leap provides several advanced settings to help optimize scripts and improve page load times. These settings can be found under Leap > Optimize > Script Execution.

  1. Script Delay: This feature delays the loading and execution of JavaScript until the primary content has loaded. By prioritizing the loading of content, Script Delay helps improve Largest Contentful Paint (LCP). Do NOT delay scripts marked with no-defer parameters: This setting prevents scripts marked with no-defer parameters such as 'data-cfasync' and 'data-pagespeed-no-defer' from being delayed. This is crucial for preventing unwanted delays that could break functionality or slow down site loading.
  2. Reduce CPU Intensive Tasks: This feature slows down JavaScript tasks that are using excessive CPU. By reducing the load on the browser's processor, it helps free up resources to render the page more efficiently, thus improving LCP. Note that this setting may affect the timing of `setInterval` and `setTimeout` calls.
  3. Disable Ads Above The Fold: This feature aims to improve page performance and Core Web Vitals (FID, LCP) by removing ads that appear above the fold (the content visible before scrolling). While this can enhance performance, it may also decrease revenue as above-the-fold ad locations are typically higher earning. Use this setting as a last resort.
  4. jQuery Loading Method: jQuery is a widely-used JavaScript library, and loading it can take time. Leap offers two methods to optimize jQuery loading:
    • Core jQuery Feature Preload: Instead of excluding the entire jQuery library when scripts that require jQuery functions are excluded, this method adds a small script to enable core functionality until the main jQuery file is loaded.
    • Load jQuery from CDN: This method loads jQuery from a global Content Delivery Network (CDN) so that more users have it cached, reducing load times.

Learn how to best implement a jQuery loading method here.

Common Issues

Script delay can cause issues with the following functionalities:

  • Menus
  • Search bars
  • Page layout
  • Image loading
  • Forms and other custom functionality

Learn how to address these issues using our Debugger here.

Conflicting Technologies

Certain technologies can make optimizing your site with script delay challenging:

  • Page Builders: Tools like Elementor and WPBakery are completely incompatible with script delay, necessitating its disablement.
  • Themes: Some themes, including Kadence and Astra, may require extensive script exclusions for correct site functionality.
  • Speed Optimization Tools: Tools such as Perfmatters and WP Rocket can conflict with script delay settings. They don't need to be disabled altogether, rather the setting that is providing duplicate functionality should be identified and turned off.

Loading ...