How to Optimize Amazon Affiliate JS with LiteSpeed Cache WordPress Plugin

Did you enable ‘Load JS Deferred‘ in the LiteSpeed Cache Page Optimization, WordPress Plugin? I don’t believe the Amazon Affiliate JS likes being deferred. Trust issues?

Go to LiteSpeed Cache => Page Optimization => [7] Tuning Settings

Scroll down until you see ‘JS Deferred Excludes’.

Add a line like:

 z-na.amazon-adsystem.com/widgets/onejs

Go to LiteSpeed Cache => Page Optimization => [3] Optimization Settings

Scroll down until you see ‘DNS Prefetch’.

Add a line like:

//z-na.amazon-adsystem.com

Go to LiteSpeed Cache => Toolbox => [1] Purge (default) => Click on Empty Entire Cache

Clears all cache entries related to your site, including other web applications. This should only be used if things are cached incorrectly.

This fixed my website. Hopefully it helps someone else from having to disable JD Deferred completely and lose the performance benefits of the optimization.