Local Fonts – Smart Optimize
Table of Contents
Smart Optimize (Only available in OMGF Pro — default: off) automatically figures out which fonts each page of your site needs. It preloads the fonts your visitors see first, and removes the fonts a page doesn’t use. For desktop and mobile separately, without any configuration.
What does Smart Optimize do?
The Load Early and Don’t Load options in Optimize Local Fonts apply to your entire site. Smart Optimize goes further, and optimizes every page individually:
- Preloads the fonts in the visible part of the page, so your text appears sooner and your LCP improves.
- Removes unused fonts: the weights, styles and subsets a page doesn’t use, so visitors download less. Fonts in tabs, accordions and popups are kept.
How to enable Smart Optimize
- Go to Settings › Optimize Google Fonts › Optimize.
- Check Smart Optimize (Pro).
- Click Save & Optimize.
From then on, Smart Optimize takes care of Load Early and Don’t Load for you. Fallback and Replace keep working as usual.
How does it work?
Smart Optimize analyzes each page in the browser of a real visitor, so it sees exactly which fonts are used, and where. This happens once per page and device, after the page has finished loading, so nobody notices. Every visitor after that gets the optimized page.
- Each language of a multilingual site is optimized separately.
- Personal pages, like WooCommerce’s cart, checkout and account pages, are left as they are.
- Smart Optimize works while the stoplight is green. When the Admin Bar Menu shows a notice or warning, it pauses, so it never preloads fonts that are still loaded from Google. Resolve the notice, or click Mark as fixed next to it on the Dashboard if it’s something you can’t change, e.g. an iframe from MailerLite, reCAPTCHA or YouTube (see Can OMGF (Pro) remove Google Fonts from iframes?).
How can I see the results?
Open a page while you’re logged in as an administrator, and hover over OMGF Pro in the admin bar. You’ll see a Desktop and/or Mobile item, listing the fonts that are Preloaded and Unloaded on that page.
No Desktop or Mobile item yet? Then the page hasn’t been visited on that device yet, or there was nothing to optimize.
Changed a page?
Changed a page’s design or fonts? Open it as an administrator, click OMGF Pro › Re-scan & optimize this page in the admin bar, and then Optimize now.
Emptied OMGF’s cache, switched themes or toggled Magic Fallbacks? Then all pages are optimized again on their next visit. Purge your page cache afterwards, so your visitors get the new version right away.
Smart Optimize and page caching
Smart Optimize purges each page from your page cache right after optimizing it, so the next visitor immediately gets the optimized version. This works with Cloudflare, FlyingPress, Kinsta, LiteSpeed Cache, SiteGround Optimizer, W3 Total Cache, WP Fastest Cache, WP-Optimize, WP Rocket and WP Super Cache.
Using a different cache, or a CDN that caches your pages? Then the optimized version appears as soon as that cache expires, or when you purge it.
Fonts from other hosts
Smart Optimize also preloads fonts from other services your site uses, like an icon pack’s CDN. For a host your site doesn’t use yet, it asks for your approval first, to keep your site safe: the stoplight turns blue, and the host is listed on the Dashboard under Smart Optimize needs your approval. Click Trust for hosts you recognize, or Ignore.
Frequently asked questions
- Is there a notification when Smart Optimize is finished?
- Will my first visitors see an unoptimized page with Smart Optimize?
- Does Smart Optimize work with Magic Fallbacks?
Developers
Smart Optimize’s filter and action hooks are listed in the Developer Docs.