Antlytics logoAntlytics
← Blog
1

Analytics Script Size: Why Lighter Is Better

How much does an analytics script slow down my site? Lightweight analytics scripts are designed to have minimal impact on page performance. Here's what to look for.

Analytics Script Size: Why Lighter Is Better

Every kilobyte of JavaScript you add to a page has a cost: parse time, execution time, and network transfer. Analytics scripts are no exception. Here is why script size matters and what to look for.

Script size comparison

Analytics scripts vary significantly in size. The standard Google Analytics tag manager library (gtag.js) is substantially larger than lightweight privacy-focused alternatives. Tools like Plausible, Fathom, and Antlytics are designed to be small — typically a few kilobytes or less. Check each tool's documentation or measure the served asset size in your browser's Network tab for a current, accurate comparison.

The difference between a large third-party script and a small one is most noticeable on mobile, low-bandwidth connections, or when combined with other third-party scripts.

Impact on load time

Script size alone does not determine performance impact. Equally important:

Loading strategy — Does the script block the page render (<script> in <head>) or load after the page is interactive (async or defer or afterInteractive in Next.js)?

Antlytics uses strategy="afterInteractive" when installed via the Next.js SDK. This means the script loads after the page is rendered and interactive. It does not affect Time to First Byte, First Contentful Paint, or Largest Contentful Paint.

Third-party domain requests — Scripts served from a third-party domain require a DNS lookup, TCP connection, and TLS handshake. Scripts served from your own domain (via the first-party proxy) skip these steps.

How async loading works

The Antlytics tracker is an inline script that fires asynchronously. When the page loads:

  1. The browser parses the HTML
  2. The inline script executes after the page is interactive
  3. The script fires a fetch() request to the ingest endpoint
  4. The request completes in the background

The user experience is unaffected. The page is fully interactive before any analytics request fires.

Measuring the impact

To see the actual performance impact of your analytics script:

  1. Open Chrome DevTools → Performance tab
  2. Record a page load
  3. Find the analytics script in the timeline
  4. Check its parse and execution time

For a well-implemented analytics script, this should be negligible — under a millisecond of execution for a small inline script.

You can also use Lighthouse or WebPageTest before and after installing analytics to confirm there is no measurable impact on Core Web Vitals.

FAQ

Will Antlytics affect my Core Web Vitals? When installed via the Next.js SDK with strategy="afterInteractive", the tracker loads after the page is interactive and is not in the critical rendering path. In typical implementations this has no measurable impact on LCP, CLS, or INP. Actual Core Web Vitals depend on your full page — use Lighthouse or WebPageTest before and after installation to confirm for your specific setup.

Should I use the first-party proxy for performance? The proxy improves data accuracy (fewer ad-blocker blocks), not performance. The performance difference is negligible.

What if I'm using Google Tag Manager? GTM itself adds script overhead. If you are adding Antlytics through GTM, the GTM container loading time is a more significant factor than the Antlytics snippet size.


Related: First-party proxy explained · Next.js analytics setup guide