Merge Scripts

Swift Performance can optimize automatically javascript delivery. For this Swift Performance will find and merge all embedded or inline javascript on the page, and merge them into one javascript file. You can also add some scripts manually with Include Scripts feature.

If you don’t want to merge scripts, it is recommended to Preload Scripts to preload key requests.

Async Execute
If you merged all scripts, even the first one can run, only when the full merged script was loaded. However if you enable Async Execute feature, Swift Performance will split the merged script on client side on the fly and run each scripts when that part was loaded. It can speed up rendering time which is an important factor for user experience. In rare cases Async Execute can break some scripts, so you should check is everything working well after activating it. However it is always recommended to enable this feature if it is possibe.

 

Delay Async Scripts
With this feature you can delay the whole merged script until the first user interaction. A well coded page shouldn’t use any javascript to rendering above the fold content, however in some cases it may happen. To be able to use Delay Async Scripts but avoid rendering issues, you can add custom critical CSS rules using Extra Critical CSS or adding a custom script.

You can delay scripts one by one instead of delay all merged scripts with Lazyload Scripts feature

 

Exclude Scripts
You can exclude files from merging/optimization one by one with Exclude Scripts option. You can use full or partial URLs/filenames here. It can be useful for example for ad or form scripts.

 

Footer Scripts
If you add any scripts here, they will be excluded from merging, but will be moved to the footer. Don’t use it for scripts which prints content where they was inserted (ad or form scripts).

 

You can also Exclude Inline Scripts or use Footer Inline Scripts if it is necessary. To exclude an inline script you need to add some unique string from its content.

With Exclude 3rd Party Scripts you can exclude easily all 3rd party javascript. It is not recommended, as usually 3rd party scripts can be further optimized, however sometimes you have to: merging 3rd party scripts can use more CPU, and some service sometimes blocks these requests.

 

Deferred Scripts
Like footer scripts, Deferred Scripts option is an alternative exclusion. It will leave the script in its original place, but adds a defer attribute to defer loading it.

 

Exclude Script Localizations
It is recommended to exclude script localization, because they can increase the merged script’s loading time, but there is no real benefit to including them.

 

Minify Scripts
It is always recommended to Minify scripts, also it is recommended to use Minify with API feature for better results.