Chapter 6. How-to Guides

Use CLS Ad Slot with JCH Optimize

CLS Ad Slot and JCH Optimize work together with their default settings. A few of JCH Optimize's Pro features change when scripts run, and need a small adjustment so your ads keep working. All the settings below are in JCH Optimize.

Reduce Unused JavaScript

Holds CLS Ad Slot's script back until the visitor first interacts with the page, so no ad loads until then, not even those on screen. Nothing shifts, because the space is reserved, but your top ads appear later. To load them straight away, add com_clsadslot to both Critical js files and Critical modules.

Reduce unused CSS

Only the styles needed for the top of the page are loaded at first, and CLS Ad Slot adds some of its classes later. Add jch-adslot--hidden, jch-adslot--fallback and cls-ad-fallback-wrapper to CSS Dynamic Selectors, so slots near the top can close and show fallback content correctly.

Reduce DOM

Adds sections below the fold only as they scroll into view. CLS Ad Slot notices slots in those sections as soon as they are added, so no change is needed.

Tip

If your ads stop appearing after you change a JCH Optimize setting, turn on CLS Ad Slot's Debug. If the debug bar doesn't appear at all, CLS Ad Slot's script isn't running; add com_clsadslot to JCH Optimize's Exclude JavaScript Files.

The debug bar is shown only while you are logged in, and by default JCH Optimize doesn't optimize pages for logged-in users. To see the problem while logged in, set JCH Optimize's Disable logged-in users to No while you test, and back to Yes afterwards.