- Completely unnecessary – these files are needed on that particular page though they may be needed on any other page on your site.
- Loading later on the page – these script files are only needed to load content on below the fold area.
- You can’t remove content from a script file without knowing its purpose.
- Each page on your site may use different scripts. Removing a script throughout on your site may increase speed on one page but break other page which needs the script to work properly. The best example for this case is the contact form plugins. These plugins will load the script files on each page though they are needed only on the pages with a contact form.
- You may not be able to reduce third-party codes.
After successful activation, navigate to “Settings > Flying Scripts” menu. There are three simple inputs needed by the plugin:
- Timeout – by default, the plugin will set 5 seconds as the timeout and after this time, the plugin will load the script even though there are no user actions to load the script.
- Disable on pages – provide the keywords of the page URLs to disable the plugin on specific pages. This is useful if you want to turn off delaying script when a particular page layout is broken.
That’s it!!! Save your changes and you are good to go. If you have provided correct keywords to include, your speed score will hit 90+ only with this small plugin.
2. Delay Everything with WP Rocket Plugin
Flying Scripts is super useful with only problem that you need to find the name of scripts and enter the keywords correctly. WP Rocket is a premium only plugin that offers exactly opposite approach. Here you can delay entire scripts on the site with single click and exclude any scripts like jQuery with keywords.
- After purchasing WP Rocket plugin, install and activate the license on your site.
- Go to “Settings > WP Rocket” menu and navigate to “File Optimization” section.
- You can anytime come back to this section and provide the scripts to be excluded from lazy loading.
- Click “Save Changes” button to save your changes.
3. Perfmatters Script Manager and Delay Script
If you want to manage scripts on per page level, enable “Script Manager” option. Now, edit any of your existing post or page and click “Script Manager” from the admin bar. You can find the scripts loaded on that page and disable them on site level or only on that page. for example, you can find the scripts loaded by Contact Form 7 plugin and disable them everywhere except on pages. It is also possible, to disable the script everywhere and enable only on specific page by editing and enabling from that page. After finishing, click on “Edit Post” from the admin bar to go back to the post editor.
Testing in Google PageSpeed Insights
Finally, go to PageSpeed Insights and test your site’s page speed and you will find it is increased to 90+ level.
Third-party script files are one of the major factors for killing page speed of a website. If you use too many external script files, you will see warning in PageSpeed Insights tool like “Reduce the impact of third-party code”.
Scripts like AdSense, Analytics, Facebook Pixels will easily reduce your speed score to poor level. You can delay them using any of the above plugin; however, it may have negative impact. For example, delaying AdSense scripts will impact your earnings especially when you show ads on the header section. Since users may not see the ad loaded on the header section, it will perform poorly thus reducing your revenue. This is especially problem with WP Rocket as you need manually exclude the ad scripts which is dynamic in nature. Therefore, make sure to understand what you are delaying and the impact instead of only looking at the speed score.