{"id":4832,"date":"2021-05-28T18:32:56","date_gmt":"2021-05-28T18:32:56","guid":{"rendered":"https:\/\/www.s-sols.com\/?post_type=doc&#038;p=4832"},"modified":"2025-06-17T15:59:21","modified_gmt":"2025-06-17T15:59:21","slug":"settings-scripts-accel","status":"publish","type":"doc","link":"https:\/\/www.s-sols.com\/docs\/wordpress\/accelerator\/settings-accel\/settings-scripts-accel","title":{"rendered":"Scripts settings Accelerator for WordPress"},"content":{"rendered":"<p style=\"text-align:justify\">\n  Scripts are separated into <a href=\".\/scripts-optimization-accel\">four categories<\/a>. In most cases all scripts are non-critical and some are special as you can see by default settings. But <a href=\".\/statistics-accel#fine_tuning\">sometimes<\/a> particular scripts should be tuned individually.\n<\/p>\n<p style=\"text-align:center\">\n  <img decoding=\"async\" src=\"\/data\/content\/doc\/wordpress\/accelerator\/settings-scripts-accel\/settings-scripts-en.png\" alt=\"settings-Scripts\" title=\"settings-Scripts - Scripts settings\" \/>\n<\/p>\n<h2><a id=\"general\"><\/a>General<br \/>\n<\/h2>\n<ul>\n<li>\n<div style=\"text-align:justify\"><strong>Optimize loading critical special, non-critical and special<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Enables loading optimization mode. Timeouts below are periods of user inactivity \u2013 no scroll, mouse move, etc. If the timeout is 0 then scripts will be only placed at the bottom of the page (just before the <code>body<\/code> closing tag). If the timeout is 1000 then it will be treated as infinity.\n    <\/p>\n<ul>\n<li>\n<div style=\"text-align:justify\"><strong>Defer critical special<\/strong>\n        <\/div>\n<p style=\"text-align:justify\">\n          Enables loading optimization for critical special scripts.\n        <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Defer non-critical<\/strong>\n        <\/div>\n<p style=\"text-align:justify\">\n          Enables loading optimization for non-critical scripts and delays it with the specified timeout.\n        <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Defer special after non-critical<\/strong>\n        <\/div>\n<p style=\"text-align:justify\">\n          Enables loading optimization for special scripts and delays it with the specified timeout.\n        <\/p>\n<p style=\"text-align:justify\"><strong>Note<\/strong>: if this is off, then all special scripts are considered non-critical.\n        <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Deep hooks<\/strong>\n        <\/div>\n<p style=\"text-align:justify\">\n          Using deep scripts injection to make delay loading.\n        <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Early preloading of non-critical<\/strong>\n        <\/div>\n<p style=\"text-align:justify\">\n          Preloads scripts to be faster executed later.\n        <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Loading without timing switching<\/strong>\n        <\/div>\n<p style=\"text-align:justify\">\n          It improves scripts\u2019 loading speed a little bit but might be incompatible with some scripts. So, it should be used carefully.\n        <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Preventing double initialization of excluded scripts<\/strong>\n        <\/div>\n<p style=\"text-align:justify\">\n          It prevents double initialization of excluded scripts.\n        <\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p style=\"text-align:justify\"><strong>Note.<\/strong> Special scripts are always loaded after non-critical. E.g. if deferring is disabled for special but non-critical are deferred, so special will be deferred too.\n<\/p>\n<h2><a id=\"group\"><\/a>Grouping<br \/>\n<\/h2>\n<p style=\"text-align:justify\">\n  Grouping improves pages\u2019 loading speed.\n<\/p>\n<p style=\"text-align:justify\"><strong>Warning. <\/strong>All scripts should be tested due to some of them can be compatible with grouping. Such scripts should be added in exclusions (see below). So, it should be used carefully.\n<\/p>\n<ul start=\"2\">\n<li style=\"text-align:justify\"><strong>Group and combine critical special<\/strong>\n  <\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Group and combine non-critical<\/strong>\n    <\/div>\n<p style=\"text-align:justify\"><strong>Note<\/strong>: if \u2018Defer special after non-critical\u2019 is disabled, then all special scripts will also fall into this group.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Excludes<\/strong>\n    <\/div>\n<ul>\n<li>\n<div style=\"text-align:justify\"><strong>Modules<\/strong>\n        <\/div>\n<p style=\"text-align:justify\">\n          Scripts that working as modules will not be processed.\n        <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Particular scripts<\/strong>\n        <\/div>\n<p style=\"text-align:justify\">\n          Scripts with URLs, IDs, or bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will not be processed. It can be added multiple expressions at once by placing each on new line. E.g. for making all inline scripts as separate files (e.g. to reduce page size), all scripts that has <code>src<\/code> attribute should be excluded from grouping, so, <code>src:@.+@<\/code> expression can be specified.\n        <\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2><a id=\"interact\"><\/a>Lazy interactions<br \/>\n<\/h2>\n<p style=\"text-align:justify\">\n  If <a href=\"#general\">scripts are delayed<\/a> then all clicks and touches are processed instantly and delayed. But sometimes there is a need to prevent from instant or delayed reaction.\n<\/p>\n<ul start=\"5\">\n<li>\n<div style=\"text-align:justify\"><strong>Animation delay<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      The timeout for keeping <a href=\".\/settings-styles-accel#custom_ani\">animation corrections<\/a> after non-critical script are loaded.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Scripts loading delay at first scroll<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      A delay that allows page effects to run smoothly on the first scroll.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>First click delay<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      The timeout for loading the main scripts when clicking on an interactive element. Allows to correct situations when a click does not work the first time.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Exclusions of instant click<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Tags matching the <a href=\".\/xpath-elements-selector-accel\">XPath selectors<\/a> will be not processed. It can be added multiple selectors at once by placing each on new line.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Exclusions of delayed click<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Tags matching the <a href=\".\/xpath-elements-selector-accel\">XPath selectors<\/a> will be not processed. It can be added multiple selectors at once by placing each on new line. If <strong>CSS selectors<\/strong> are added it will be checked only at runtime \u2013 it allows to exclude elements that generated not in backend. Also, <strong>CSS selectors<\/strong> can be added by XPath condition via using <code>ifExistsThenCssSel<\/code> function, e.g. <code>ifExistsThenCssSel(.\/\/script[@id=\"cookieyes\"],\".cky-btn\")<\/code>. It means that <code>.cky-btn<\/code> will be used in frontend checking only if <code>.\/\/script[@id=\"cookieyes\"]<\/code> exists.\n    <\/p>\n<\/li>\n<\/ul>\n<h2><a id=\"minify\"><\/a>Minify<br \/>\n<\/h2>\n<p style=\"text-align:justify\">\n  Optimizes JS code to have a smaller size.\n<\/p>\n<p style=\"text-align:justify\"><strong>Warning.<\/strong> All scripts should be tested due to some of them can be compatible with minification. Such scripts should be added in exclusions (see below). So, it should be used carefully.\n<\/p>\n<ul start=\"10\">\n<li>\n<div style=\"text-align:justify\"><strong>Enable<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Optimizes but preserves any copyright information in comments.\n    <\/p>\n<ul>\n<li style=\"text-align:justify\"><strong>Remove copyright information<\/strong>\n      <\/li>\n<\/ul>\n<p style=\"text-align:justify\">\n      Removes all comments from JS code.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Excludes<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Scripts with URLs, IDs, or internal bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will not be processed. It can be added multiple expressions at once by placing each on new line.\n    <\/p>\n<\/li>\n<\/ul>\n<h2><a id=\"critspecial\"><\/a>Critical special<br \/>\n<\/h2>\n<p style=\"text-align:justify\">\n  Scripts with URLs, IDs, or internal bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will be treated as critical special. It can be added multiple expressions at once by placing each on new line.\n<\/p>\n<h2><a id=\"non_critical\"><\/a>Non-critical<br \/>\n<\/h2>\n<ul>\n<li>\n<div style=\"text-align:justify\"><strong>Inlined<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Includes all inline scripts.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Internal<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Includes all internal (hosted on our site) scripts.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>External<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Includes all external (hosted on the other sites) scripts.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Exclude<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Scripts with URLs, IDs, or internal bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will be treated as critical. It can be added multiple expressions at once by placing each on new line.\n    <\/p>\n<p style=\"text-align:justify\"><strong>Note. <\/strong>It can be added here automatically in program code by specifying <code>seraph-accel-crit<\/code> attribute like this<strong> <\/strong><code>&lt;script seraph-accel-crit=\"1\"&gt;<\/code>.\n    <\/p>\n<\/li>\n<li>\n<div style=\"text-align:justify\"><strong>Include only<\/strong>\n    <\/div>\n<p style=\"text-align:justify\">\n      Only scripts with URLs, IDs, or internal bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will be treated as non-critical. It can be added multiple expressions at once by placing each on new line.\n    <\/p>\n<\/li>\n<\/ul>\n<h2><a id=\"special\"><\/a>Special<br \/>\n<\/h2>\n<p style=\"text-align:justify\">\n  Scripts with URLs, IDs, or internal bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will be treated as special. It can be added multiple expressions at once by placing each on new line.\n<\/p>\n<h2><a id=\"skip\"><\/a>Not needed<br \/>\n<\/h2>\n<p style=\"text-align:justify\">\n  Scripts with URLs, IDs, or internal bodies matching the specified <a href=\".\/regexp-accel\">regular expressions<\/a> will not be loaded. It can be added multiple expressions at once by placing each on new line.\n<\/p>\n<h2><a id=\"other\"><\/a>Treat as scripts<br \/>\n<\/h2>\n<p style=\"text-align:justify\">\n  Some scripts might be loaded not via the <code>script<\/code> tag, e.g. <code>iframe<\/code> one. So, tags matching the specified <a href=\".\/xpath-elements-selector-accel\">XPath selectors<\/a> will be treated as scripts and processed by other script settings excluding the source\u2019s body. It can be added multiple selectors at once by placing each on new line.\n<\/p>\n<p style=\"text-align:justify\"><strong>Note<\/strong>. Specified <code>iframe<\/code> tags are automatically excluded from <a href=\".\/settings-frames-accel\">Video and frames<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scripts are separated into four categories. In most cases all scripts are non-critical and some are special as you can see by default settings. But sometimes particular scripts should be tuned individually. General Optimize loading critical special, non-critical and special Enables loading optimization mode. Timeouts below are periods of user inactivity \u2013 no scroll, mouse&#8230;<\/p>\n","protected":false},"author":18,"featured_media":0,"parent":4812,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"rank_math_lock_modified_date":false},"categories":[816],"tags":[],"class_list":["post-4832","doc","type-doc","status-publish","hentry","category-accelerator"],"_links":{"self":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/doc\/4832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/doc"}],"about":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/types\/doc"}],"author":[{"embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/comments?post=4832"}],"up":[{"embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/doc\/4812"}],"wp:attachment":[{"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/media?parent=4832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/categories?post=4832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.s-sols.com\/api\/wp\/v2\/tags?post=4832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}