Website Analytics Setup Guide: From Google Analytics to privacy-friendly alternatives

If you cannot answer "how many people see this page, where they come from, and where they drop off," your optimization and ad spend are mostly guesswork. Data-driven work does not start with a BI tool — it starts with installing the tracking code correctly and completely. This article covers the most common Google Analytics 4 setup, then privacy-friendly alternatives like Plausible and Umami, and ends with a practical combination for 2026.

Tool Comparison

Here is how the main tools differ:

Tool Type Price Feature
Google Analytics 4 SaaS Free Comprehensive, Google ecosystem
Plausible SaaS/Self-hosted Free/$9+ per month Lightweight, privacy-first
Umami Self-hosted Free Open source, simple
Fathom SaaS $14+ per month Clean, privacy-first
Matomo SaaS/Self-hosted Free/€19+ per month Open source, full data control
Cloudflare Analytics SaaS Free No JS needed, basic data

How to choose: if you only care about traffic trends, sources, and bounce rate, Plausible or Umami is enough. If you need deep behavioral analysis, attribution, and monetization analysis, GA4 offers a richer set of dimensions. The two are not mutually exclusive.

Google Analytics 4 setup

GA4 is installed with the global site tag (gtag.js). Create a data stream in the admin console to get a Measurement ID like G-XXXXXXXXXX, then paste it into the <head>:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Three reminders: replace the ID with your own; GA4 does not track cross-domain by default, so multi-subdomain setups need extra configuration; and under GDPR and similar regulations, many regions require consent before loading tracking scripts — Consent Mode keeps tags dormant until the user agrees.

Privacy-friendly option: Plausible

Plausible's philosophy is "good enough is enough": it counts pageviews, unique visitors, referrers, and bounce rate without cookies or personally identifiable data. Integration is a single line:

<!-- Plausible (self-hosted or cloud) -->
<script defer data-domain="example.com" src="https://plausible.io/js/script.js"></script>
  • No cookie banner needed (GDPR-friendly)
  • No personal data collected
  • Tiny script, negligible performance impact
  • Open source and transparent; can be self-hosted

It suits daily monitoring like "is traffic healthy, is the content direction working." The downside is limited dimensions — no complex funnels or user-level analysis.

Self-hosted deployment with Umami

Umami is fully open source and keeps data entirely in your hands. The official recommendation is Docker, and a single docker-compose.yml gets it running:

# docker-compose.yml
version: '3.8'
services:
  umami:
    image: ghcr.io/umami-software/umami:latest
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgresql://umami:password@db:5432/umami
    depends_on:
      - db

  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: password
    volumes:
      - umami-db:/var/lib/postgresql/data

volumes:
  umami-db:

Self-hosting means you operate the database and backups yourself. If your traffic is low, a 1C1G machine is plenty; as traffic grows, consider more memory or moving the database to its own instance.

Setting up the dual-layer strategy

A pragmatic path has two steps. First, add the Plausible or Umami script to the shared site header as your everyday data source — you can see live visits within minutes. Second, if you truly need behavioral data and conversion funnels, add GA4 to key pages and pair it with Consent Mode under your privacy policy. Most sites can answer "where does traffic come from and is the content working" with the lightweight option alone, and only reach for GA4's complexity when deep analysis is genuinely required.

Key metrics explained

Once the tool is installed, you still need to read the numbers:

Metric Definition Reference
Pageviews (PV) Total times a page was opened Depends on scale
Unique visitors (UV) De-duplicated visitor count Usually 60-70% of PV
Bounce rate Share of single-page visits < 50% is good
Avg. session duration Average time per visit > 2 min is good
Pages/session Pages viewed per session > 3 is good
Conversion rate Share completing a goal Depends on industry

The reference values only suit content sites; e-commerce and tool sites measure differently, so compare against your own history.

Common mistakes

  • Install and forget: if you never look at the data, the setup is wasted. Spend 10 minutes a week on trends and anomalies;
  • Conflicting trackers: GA4 plus Plausible is fine, but adding a homegrown counter on top can break script load order;
  • Ignoring data privacy: serving EU individuals without consent before loading tracking scripts is a compliance risk;
  • Conclusion from a single day: traffic is noisy; look at 7- or 30-day trends;
  • Tool as an end in itself: metrics that never lead to a next action are waste; define the decision each metric drives first.

16IDC Takeaway

For 2026 websites, use a dual-layer analytics strategy: Plausible/Umami for daily traffic monitoring (privacy-friendly, no performance impact), and GA4 for deep analysis (with user consent). This balances privacy compliance with analytical capability.

This pairing also adds reliability: the lightweight tool can keep running if the main one hiccups, avoiding a "no stats at all" gap.

Reference: GA4 official docs — https://support.google.com/analytics ; Plausible Docs — https://plausible.io/docs ; Umami docs — https://umami.is/docs