Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Missing preconnect to fonts and CDN: how to add it and fix it

PRF-023Low impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

Before a browser can download a file from another domain, it has to do three things: look up the domain (DNS), open a connection (TCP) and secure it (TLS). This is called connection setup. It can take a noticeable fraction of a second, especially on mobile networks.

A preconnect hint is a line in your page <head> that tells the browser to do this setup early. If it is missing, the browser only starts the setup once it reads the CSS or HTML that mentions the file. Typical origins that need it are https://fonts.gstatic.com (Google Fonts files), your image CDN, or a font host such as Adobe Fonts.

Why it costs you leads or sales

Slow connection setup pushes back the moment your headline and hero image appear. Largest Contentful Paint (LCP) is the time until the biggest visible element has loaded. Visitors who see a blank or unstyled page for longer are more likely to leave before they reach your form or buy button.

The effect is usually small, often a few hundred milliseconds. It adds up with other delays on paid landing pages, where each lost visitor is a click you paid for.

Where the delay happens
  1. HTML arrivesBrowser reads the head
  2. CSS requests a fontThird-party origin discovered late
  3. DNS + TCP + TLSConnection setup starts only now
  4. Font downloadsText renders late
  5. LCPLargest element appears later

Without preconnect, connection setup to the font host starts only after the CSS is parsed.

Time to first font byteExample numbers
Time to first font byte (example)No preconnect: 650 ms; With preconnect: 400 ms0249498650400No preconnectWith preconnectms

Example: illustrative numbers on a mid-range mobile connection. Real savings depend on the network and the host.

How to check if your site has it

Check your page for missing preconnect hints
  1. List third-party origins

    Open your page in Chrome, press F12, go to the Network tab, reload and sort by Domain. Note the origins that serve fonts, CSS, or your hero image.

  2. Look at the head

    Right-click, choose View page source and search for rel="preconnect". Compare the list with the origins you noted.

  3. Run Lighthouse

    In Chrome DevTools open the Lighthouse tab and run a Performance report. Look for the audit named 'Preconnect to required origins' (it may appear as a diagnostic).

  4. Use a waterfall

    In a tool such as WebPageTest, check whether the third-party request shows DNS, connect and SSL bars right before the file download. Those bars are the delay a preconnect hides.

How to fix it

Add a preconnect tag near the top of the <head>, before the stylesheets that use the origin. Keep it to the origins that serve critical, above-the-fold files. Too many hints compete for bandwidth and can slow the page.

Preconnect for Google Fonts and an image CDNhtml
<head>
  <meta charset="utf-8">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link rel="preconnect" href="https://cdn.example.com">
  <!-- stylesheets follow -->
</head>
Add preconnect on your platform
  1. Use a performance plugin if you have one

    Some optimisation plugins have a 'Preconnect' or 'Resource hints' setting. Add your origin there.

  2. Or add it in code

    In a child theme's functions.php, hook wp_resource_hints or wp_head at priority 1 and output the link tags. Avoid editing the parent theme, as updates overwrite it.

  3. Check for duplicates

    Some themes already add hints for Google Fonts. View source and remove repeats.

How to confirm it's fixed

Confirm the hints work
  • View source shows each rel="preconnect" tag in the head, before the stylesheets.
  • Font hosts have the crossorigin attribute.
  • In the DevTools Network waterfall, the third-party request no longer shows a long DNS/connect/SSL stage before download.
  • Lighthouse no longer lists the origin under 'Preconnect to required origins'.
  • You have no more than a few preconnect tags, and none for origins the page does not use.
  • The page still looks and works the same on mobile.

How to prevent it happening again

Resource hints go stale. When you change font provider, switch CDN or remove a script, the old tag stays and the new origin has none. Keep these habits:

Keep hints current
  • Review preconnect tags whenever you change fonts, CDN or theme.
  • Remove hints for origins you no longer use.
  • Run Lighthouse or PageSpeed Insights after each major template change.
  • Keep the hint list short, only for origins used above the fold.
  • Record the reason for each hint in a code comment.

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. FunnelGuard runs your real customer journeys (forms, checkouts, booking and chat buttons), the tracking hits and test lead delivery. It does not audit resource hints in your page head.

The kind of tool that fits is a page speed or web performance testing tool, such as Lighthouse, PageSpeed Insights or WebPageTest, which shows connection timing and lists missing preconnect hints. Use FunnelGuard alongside it to check that your forms, checkouts and tracking still work after you change your page head.

Questions people ask

What does preconnect do?

Preconnect tells the browser to open a connection to another domain before it needs a file from it. That means DNS lookup, TCP connection and TLS setup happen early, so the file can start downloading as soon as the page asks for it.

Why does preconnect for Google Fonts need crossorigin?

Font files are fetched in anonymous CORS mode. A preconnect without the crossorigin attribute creates a connection that font requests cannot reuse. Add crossorigin to the fonts.gstatic.com hint.

How many preconnect hints should I use?

Use as few as possible, usually one to three, for origins that serve critical above-the-fold files. Each hint uses CPU and network at the start of the page load, so too many can slow things down.

Does preconnect improve LCP?

It can, when your hero image or a font loads from another origin, because it removes the connection setup from the critical path. The gain is usually small. It does nothing if all your files are on your own domain.

What is the difference between preconnect and dns-prefetch?

Dns-prefetch only resolves the domain name. Preconnect also opens the TCP and TLS connection, so it saves more time. Dns-prefetch is a lightweight fallback for older browsers or for origins you may use later.

Where do I put the preconnect tag?

Put it in the <head>, as high as possible and before the stylesheets or scripts that request files from that origin. A tag added late by JavaScript or a tag manager helps much less.

Do I need preconnect if I self-host my fonts?

No. Self-hosted fonts come from your own domain, which the browser is already connected to. You may still want a hint for an external image CDN or other third-party origin that serves critical files.

Can FunnelGuard tell me if preconnect is missing?

No. This is outside what FunnelGuard checks. Use a page speed tool such as Lighthouse, PageSpeed Insights or WebPageTest for that.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.