Tips・Publishing your work

Adding analytics to see who visits

How many people came, and which pages they read. Two free analytics options for personal sites, compared on ease of setup and privacy, plus the numbers worth looking at first.

Once your site is live, you want to know how many people came and which pages they read. Here are two free options that suit personal sites, compared on setup effort and privacy.

Two options

Cloudflare Web AnalyticsGoogle Analytics (GA4)
CostFreeFree
SetupOne scriptOne script plus property setup
CookiesNoneUses them
What you learnViews, visitors, referrers, top pagesThe above plus time on page, user flows, deeper analysis
DifficultyGentleMany screens; takes getting used to

Start with the lighter one. Once checking numbers is a habit and you want more, add GA4.

Cloudflare Web Analytics

Analytics that uses no cookies and doesn’t track visitors as individuals. You can run it without a consent banner, and there’s only one screen to read, so nothing gets confusing.

The Cloudflare Web Analytics page, showing the headline “Free website analytics” and an illustration of a dashboard with charts
Create a Cloudflare account, add your site, and you’re given a tag.

Cloudflare Web Analytics

Paste the tag just before </body> on every page.

  <script defer src="https://static.cloudflareinsights.com/beacon.min.js"
          data-cf-beacon='{"token": "the string you were given"}'></script>
</body>

Google Analytics (GA4)

The most widely used analytics tool in the world. It shows time on page, where people came from, and the path they took. You’re likely to meet it at work someday, so setting it up is good practice in itself.

The Google Analytics product page, showing a headline about getting essential insights and a button to get started
Start with a Google account and create a property to get your measurement ID.

Google Analytics

Use the measurement ID it issues (a string starting with G-) in a tag inside <head>.

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

The four numbers to start with

NumberMeaningHow to use it
VisitorsHow many people cameOverall momentum
PageviewsHow often pages were shownRoughly, pages per person
Top pagesWhat’s read mostWhat to write next
ReferrersSearch, social, directWhich entrance is working

The most useful is top pages. Discovering that a page you didn’t expect is the one being read is this tool’s greatest gift.

How it differs from Search Console

Both are free, and they look at different places.

  • Search Console — the search side. Which queries you appeared for, and how many impressions you got
  • Analytics — your site’s side. Which pages visitors read, and how

With both, you can follow the whole path: appeared in search → clicked → read this page.

TipsSeeing how search views your site with Search ConsoleSetting up Search Console for the search side

Respecting privacy

A privacy policy doesn’t need to be elaborate. Even “This site uses Google Analytics to understand how it’s used. No personally identifying information is collected” is far more honest than nothing.

Summary

  1. Start with Cloudflare Web Analytics — one script, no cookies, no consent banner needed
  2. Add GA4 when you want detail; it’s also what you’ll meet professionally
  3. Watch top pages and referrers, monthly. If you use cookies, say so in a privacy policy

Once you can see the numbers, a site stops being something you finished and becomes something you grow.

FAQ

Is there free analytics for a personal site?
Yes. Both Cloudflare Web Analytics and Google Analytics (GA4) are free. The former installs with a single script and uses no cookies.
Do I need a cookie consent banner if I add analytics?
Cookie-based analytics such as GA4 require consent in some regions. Cloudflare Web Analytics, which uses no cookies, spares you that.
What's the difference between pageviews and visitors?
Pageviews count how many times pages were shown; visitors count people. One person viewing three pages is 1 visitor and 3 pageviews.