Home / Guides

Free website visitor counter: add one in 2 minutes (HTML code)

Updated: October 14, 2026

Old-school hit counters showed a number on the page — "You are visitor #10,482". Today most people want the same information privately: how many visitors came, from where, and what they looked at. Here is how to add a free counter to any site.

Public hit counter vs analytics counter

Public hit counter widget Analytics counter
Shows One total number on your page Visits, visitors, sources, pages, devices, goals
Who sees it Every visitor Only you (or a share link)
Accuracy Often counts reloads and bots Filters bots, counts visits properly
Looks Dated widget Invisible

Unless the number on the page is part of your design, an analytics counter is the better choice.

Add a free counter with one line of HTML

With LightMetrica the whole setup is:

  1. Create a free account and add your site's address.
  2. Copy your tracking code:
<script defer src="https://lightmetrica.com/lm.js" data-site="YOUR-ID"></script>
  1. Paste it before </head> in your site's template so it loads on every page.
  2. Open your site. The counter page shows "Active" after the first visit — usually within seconds.

The script is about 2 KB, loads asynchronously and doesn't use cookies, so it won't slow your pages or require a cookie banner for the counter itself.

Where to paste the code

Detailed instructions: WordPress, Wix, Shopify, Webflow, Next.js.

What you'll see

Want to show the numbers to someone else? Turn on a public link in the counter settings — read-only, no account needed. Here is ours: live stats.

Excluding your own visits

Open your site once with ?lightmetric=ignore at the end of the address (for example https://example.com/?lightmetric=ignore) in each browser you use. The counter will skip your visits from then on.

Try LightMetrica — free

Lightweight, independent, cookie-free analytics: the counter installs in a minute — on its own or next to your current tools. Every week — an AI-powered Smart Report: what changed and what to do next.