All posts
TipsHostupa Team

How to Add Analytics to a Static Website (5 Methods)

A static website is fast, cheap, and secure — but without a backend, how do you track visitors? Here are five ways to add analytics to a static site, from zero-setup to fully custom.

Method 1: Hostupa's built-in analytics (zero setup)

If you host your site on Hostupa, analytics are built in. No code to add, no script to install.

What you get

  • Page views — Total and unique
  • Referrers — Where traffic comes from
  • Device type — Mobile vs. desktop
  • Country — Geographic distribution
  • Timeline — Views over time

How it works

Every time someone visits your hosted project, Hostupa records the view server-side. You see the data in your dashboard under the project's Analytics tab.

Available on

  • Free plan — Basic view count
  • Starter ($3/mo) — Views, unique visitors, referrers, device type
  • Solo ($9/mo) and above — All of the above plus country and timeline

Best for

People who want analytics without adding any code or scripts to their site.

Method 2: Google Analytics 4 (most comprehensive)

Google Analytics is the industry standard. The free tier is generous and covers most needs.

How to add it

1. Create a GA4 property at analytics.google.com 2. Get your measurement ID (starts with G-) 3. Add the GA4 tag to your HTML <head>:

`html <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> `

4. Upload your HTML to Hostupa (or edit it with the code editor)

Best for

People who need detailed analytics, conversion tracking, and integration with Google Ads.

Method 3: Plausible (privacy-friendly)

Plausible is a lightweight, privacy-friendly analytics tool. No cookies, no GDPR consent banner needed.

How to add it

1. Sign up at plausible.io 2. Add your site 3. Add the script to your HTML <head>:

`html <script defer data-domain="your-domain.com" src="https://plausible.io/js/script.js"></script> `

Best for

People who want simple, privacy-compliant analytics without cookies.

Method 4: Fathom Analytics (simple and fast)

Fathom is another privacy-friendly option. It is paid but very simple.

How to add it

1. Sign up at usefathom.com 2. Add your site 3. Add the script to your HTML:

`html <script src="https://cdn.usefathom.com/script.js" data-site="XXXXXXXX" defer></script> `

Best for

People who want beautiful, simple analytics and do not mind paying for them.

Method 5: Umami (self-hosted, open source)

Umami is an open-source analytics tool you can self-host.

How to add it

1. Deploy Umami on your own server (or use their cloud version) 2. Add the tracking script to your HTML:

`html <script async src="https://your-umami-instance.com/script.js" data-website-id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"></script> `

Best for

People who want full control over their analytics data and are comfortable with self-hosting.

Comparison

MethodCostSetupPrivacyDetail
Hostupa built-inFrom $0ZeroServer-sideGood
Google Analytics 4FreeAdd scriptCookies requiredExcellent
Plausible$9/moAdd scriptNo cookiesGood
Fathom$14/moAdd scriptNo cookiesGood
UmamiFree (self-hosted)Add script + serverNo cookiesGood

Recommendation

If you host on Hostupa, start with the built-in analytics — it requires zero setup. Add Google Analytics if you need conversion tracking or Google Ads integration. Switch to Plausible or Fathom if privacy compliance is a priority.

Get analytics on your static site →