Skip to main content

Load Third-party Scripts on Interaction

Updated this week

FlyingPress can delay third-party JavaScript - like ads, analytics, and widgets—until the user interacts with the page. This improves performance by reducing JavaScript execution during initial load and helps boost Core Web Vitals.

How it works

  • Our cloud optimizer automatically detects third-party scripts (scripts loaded from external domains)

  • These scripts are not loaded during initial page load

  • They are loaded only after user interaction (scroll, click, tap, etc.)

What gets delayed

Any script loaded from an external domain (not your site) will be delayed. Examples include:

Service

Script source URL

Google Analytics

https://www.googletagmanager.com/gtag/js

Facebook Pixel

https://connect.facebook.net/en_US/fbevents.js

Google Ads

https://pagead2.googlesyndication.com/adsbygoogle.js

YouTube embeds

https://www.youtube.com/iframe_api

Intercom Chat

https://widget.intercom.io/widget/abc123

Tawk.to Live Chat

https://embed.tawk.to/...

Excluding third-party scripts

If a script is essential and should not be delayed, you can exclude it by adding a keyword from the script tag—typically part of the domain or filename.

✅ Matching is partial and case-insensitive
Wildcards are not supported
🔒 Avoid generic terms like facebook - prefer full or unique domain names

Example script:

<script src="https://connect.facebook.net/en_US/fbevents.js"></script>

Recommended exclusion keywords:

connect.facebook.net
fbevents.js

Avoid using:

facebook
fb

These are too generic and may unintentionally match other unrelated scripts.

Best practices

  • Use full or specific domain parts like googletagmanager.com, youtube.com, doubleclick.net

  • Avoid vague keywords—use what uniquely identifies the script

  • Always test your site to ensure key third-party features (like tracking or chat) still work

Did this answer your question?