Lightweight analytics without spying or slowdown

Understand what happens on your site without heavy trackers, cookie banners, or performance hits: server logs, lightweight counters, or a tiny DIY script.

analyticsprivacyperformanceuxops

You want to know who visits and what people do — without half-screen trackers and slower pages. You can. No Google Analytics, no consent pop-up circus.

What “lightweight analytics” means

Track just the essentials — how many people came, from where, which pages they read, and whether they click — without personal data, cookies, or 300-KB scripts.

Why it’s better

  • 🚀 Faster — no heavy JS payloads.
  • 🕵️ More private — no device/print tracking.
  • 💬 Less bureaucracy — cookie banners often unnecessary.
  • 🧩 Sufficient — enough signal to know what works.

Ways to implement

Option 1 — read server/edge logs

Most hosts/Cloudflare expose traffic stats: visitors, countries, top pages. Often good enough.

Pros: zero bytes on page, cookie-less, already there.
Cons: fewer action details (no button clicks), needs access to logs.


Option 2 — a lightweight counter

Use a small script (Plausible, Umami, Simple Analytics). They:

  • avoid cookies,
  • avoid personal data,
  • show the essentials: views, sources, goals/clicks.

Pros: nice dashboards; events/goals built-in.
Cons: a tiny JS snippet; may be paid.


Option 3 — tiny DIY script

Comfortable with code? Send a beacon to /stats on page load or click; aggregate on the server.

<script>
  // pageview
  fetch('/stats', {
    method: 'POST',
    keepalive: true,
    headers: {'Content-Type':'application/json'},
    body: JSON.stringify({ t: 'pv', p: location.pathname, r: document.referrer })
  });

  // click tracking
  document.addEventListener('click', (e) => {
    const el = e.target.closest('[data-track]');
    if (!el) return;
    fetch('/stats', {
      method: 'POST',
      keepalive: true,
      headers: {'Content-Type':'application/json'},
      body: JSON.stringify({ t: 'click', id: el.dataset.track, p: location.pathname })
    });
  });
</script>
Pros: zero dependencies; exactly what you need.
Cons: you build the ingestion/aggregation.

What to watch
👀 page views

📍 sources (referrals, search, social)

⏱️ engagement (which pages hold attention)

🎯 goal clicks (buttons, forms, links)

That’s enough to see where your traffic pays off — or leaks.

Bottom line
Skip the tracking zoo. Lightweight, transparent analytics gives you the signal you need — and users the privacy they deserve.

yaml
Copy code