JavaScript Tab
How JavaScript is optimized, moved and deferred, which files and scripts are left alone or removed, and Reduce Unused JavaScript.
JavaScript automatic settings
Set by the automatic settings on the dashboard.
- Optimize JavaScript Files (WordPress: Combine JavaScript files)
-
Optimizes JavaScript files: replaces the links to your JavaScript files with links to optimized copies.
- Minify JavaScript
-
Removes unnecessary spaces and comments from JavaScript.
Default: NoRisk: Low - Include in-page JavaScript (WordPress: Include in-page <script> declarations)
-
Also optimizes scripts written into the page in
<script>elements, keeping their order.Default: NoRisk: Medium - Position JavaScript file at bottom of page (WordPress: Position JavaScript files at bottom of page)
-
Moves JavaScript files to the end of the page so the page can be shown first. Also processes scripts in the body of the page, not just the head. Files after an excluded file keep their position relative to it.
- Defer JavaScript (WordPress: Defer or load JavaScript asychronously)
-
Adds the
deferattribute to optimized JavaScript files, so they run after the page has been shown. Needs Position JavaScript files at bottom of page.
Exclude JavaScript
JavaScript files and scripts JCH Optimize leaves untouched. Each entry matches any file or script that contains it, and has two options: Ignore execution order and Don't move. See the section called “Excluding a File That Breaks Something”.
- Exclude JavaScript Files
-
JavaScript files to leave untouched.
- Exclude js files from these extensions (WordPress: Exclude JavaScript files from these plugins)
-
Leaves every JavaScript file from the chosen extensions, plugins or themes untouched. Choose the folder name.
- Exclude individual internal SCRIPT declarations (WordPress: Exclude individual in-page <script>'s)
-
Scripts written into the page to leave untouched. Enter a distinctive part of the script.
- Load these files after the first paint
-
Analytics and ad pixel script files to start only after the page has painted. PageSpeed counts every file that finished loading before the page's largest paint in that time, whether the paint needed it or not, so a tag's file can cost a phone's score a second or more. Listed files still load on every page view, without waiting for the visitor to interact, a moment after the paint. Only the file waits: the tag's snippet in the page stays where it is, so consent defaults and the tag's commands keep their order, and a consent manager still holds a tag back until the visitor agrees. A listed file is excluded as with Ignore execution order, so it needs no entry in Exclude JavaScript Files, and it is never combined or held back by Reduce Unused JavaScript, which this setting doesn't need. Don't list a consent manager, which must run before every tag, or a script the page needs to display. Enter part of each file's address, for example
googletagmanager.com/gtag/js.Default: EmptyRisk: Medium - Load these files asynchronously
-
Script files that must run unchanged but that no other script depends on, such as a consent manager, to load without blocking the page from rendering. PageSpeed reports such a file under render-blocking requests: the browser stops drawing the page until it has downloaded and run it. A listed file stays where it is, so its download still starts early, and is given the
asyncattribute, so the page renders while it loads and the file runs as soon as it arrives. A file already markeddeferorasyncis left as it is. Don't list a file another script needs to have run first. A consent manager that blocks trackers until the visitor agrees can load this way only when every tracker reaches the page after it has run, for example from Load these files after the first paint: a tracker written into the page itself, or one that sets Google Consent Mode's defaults, needs it to run first. Don't list one whose banner is the largest thing on the first screen either, because the banner then appears later. A listed file is excluded as with Ignore execution order, so it needs no entry in Exclude JavaScript Files, and it is never combined or held back by Reduce Unused JavaScript. Enter part of each file's address.Default: EmptyRisk: Medium - Exclude all internal SCRIPT declarations (WordPress: Exclude all internal <script> declarations)
-
Leaves every script written into the page untouched.
Default: NoRisk: Low
Remove JavaScript files
JavaScript files to stop loading altogether. See the section called “Stop an Unused File from Loading”.
- Remove JavaScript files
-
JavaScript files that are not loaded at all, on any page. Make sure no page needs them.
Reduce Unused JavaScript Pro
Holds back JavaScript until the visitor interacts with the page, except the critical scripts you list. See the section called “Reduce Unused JavaScript”.
- Enable
-
Holds back JavaScript files until the visitor interacts with the page.
- Critical js files (WordPress: Critical JavaScript files)
-
JavaScript files needed to display the page, which are loaded straight away.
- Critical scripts
-
Scripts written into the page that are needed to display it. Enter a distinctive part of the script.
Default: EmptyRisk: Medium - Critical modules
-
JavaScript module files needed by your critical scripts.
Default: EmptyRisk: Medium - Critical inline modules
-
Inline JavaScript modules needed to display the page.
Default: EmptyRisk: Medium - Preload critical js Joomla
-
Preloads the critical JavaScript files. Can reduce layout shift when scripts build the top of the page. Use only if it measurably helps.
Default: NoRisk: Low - Configure Helper
-
Opens the Critical JavaScript Configuration window, which lists the scripts on a page and lets you test marking them as critical. Shown only while Debug Plugin is on. See the section called “Reduce Unused JavaScript”.
Default: —Learn more: the section called “Reduce Unused JavaScript”
On This Page