An independent guide · Simple visitor counters for every kind of website

Count Visitors. Even Without JavaScript.

The humble visitor counter is still a practical tool. For a personal homepage, a hobby blog or a forum profile, a small number that says “people have been here” is often all you need – no analytics suite required.

The catch is that many hosting platforms restrict JavaScript, and some places, like forum signatures, only accept an external image. This guide explains how JavaScript counters and HTML-only image counters work, which one fits where, and what each one can honestly measure.

The second button leads to counter.gratis, an affiliated service. See the disclosure.

my-homepage.example
Visitors to this guide Live visitor counter
Live counter for this guide (Style 735), powered by counter.gratis. Counting may be affected by caching and blockers.

JavaScript counters

Run in the visitor’s browser. More context, but they only work where scripts are allowed.

HTML image counters

A plain <img> tag. Works almost anywhere images do, but counts server requests, not true pageviews.

Neither is perfect

Caching, blockers, proxies and bots mean every counter is an estimate. Treat the number as a trend.

01

JavaScript vs. HTML-only counters

Both approaches end with a request to a counter server. The difference is who builds that request: a script running in the browser, or the browser’s ordinary image loader.

Comparison of JavaScript-based and HTML-only image visitor counters
Aspect JS JavaScript-based counter IMG HTML-only image counter
Installation requirements Paste a <script> snippet into the page or template. The platform must allow custom JavaScript, which many free website-builder plans don’t. Paste an <img> tag, Markdown image or BBCode [img]. The platform only needs to allow external images.
Pageview counting The script runs on each page load and can add a cache-busting value to its request, so repeat views are usually recorded. It can also count navigation in single-page apps. Counts each image request that reaches the counter server. Cached or proxied copies aren’t counted, and duplicate loads may be counted twice.
Referrer information Can read the current page address and document.referrer, the page the visitor came from, subject to the referring site’s policy. Only receives the Referer header of the image request. Modern browsers usually send just the origin cross-site, e.g. https://example.com/ without the path, and proxies often send none.
Browser and screen information Can read screen size, viewport, language and time zone, if the service chooses to collect them. Limited to request headers: user-agent string, accepted languages and IP address. There’s no way to learn screen size.
Compatibility Self-hosted sites, static hosts and platforms that permit scripts. Blocked on many free builder plans, forums and profile pages. Very broad: forums, profiles, restrictive builders and Markdown pages. Fails where external images are stripped, rehosted or blocked.
Image caching Mostly not an issue: the script controls its request and can make each one unique. The main weakness. The counter server can send no-cache headers, but browsers, CDNs and image proxies don’t always respect them.
Limitations Doesn’t count visitors with JavaScript disabled or blocked by content blockers, or pages whose Content Security Policy forbids third-party scripts. Doesn’t count visitors whose images are blocked or served from a cache. It can’t tell people from bots well, and estimating unique visitors is harder.

02

Platform compatibility

What matters is not whether a platform is “compatible” but what it lets you embed: a script, raw HTML, an image from an external URL, or nothing at all. Plans and policies change, so check the platform’s current documentation and test on a published page.

  • Documented A restriction or feature described in the platform’s own documentation or plan comparison.
  • Test first Possible in principle, but caching, proxying or sandboxing may affect counting. Verify on a live page.

WordPress.com Free

JavaScript
Documented Scripts are stripped from posts and widgets on plans without plugin or custom-code support. Only higher plans allow plugins and code.
Image counter
Test first External images can be added by URL or in a Custom HTML block. WordPress.com may serve them through its image service, which caches copies and can hide repeat views.

Embed with the Image block “Insert from URL”, or an <img> tag in a Custom HTML block.

Official documentation: WordPress.com: Custom HTML support

Squarespace Basic

JavaScript
Documented Site-wide code injection and JavaScript in Code Blocks are limited to higher plans. Check the current plan comparison, since tiers have been renamed over time.
Image counter
Test first An <img> tag in a Code Block or a Markdown block may work. Make sure the image is still loaded from the counter server and hasn’t been uploaded as a copy.

Don’t download and re-upload the counter image. A copy on Squarespace’s servers will never change.

Official documentation: Squarespace: custom code documentation

Wix

JavaScript
Documented The Embed HTML element runs code inside a sandboxed iframe on a separate domain. Site-wide Custom Code requires a premium plan with a connected domain.
Image counter
Test first An <img> inside an Embed HTML element can load from the counter server, but the Referer header and JavaScript page context may describe the embed iframe rather than the parent Wix page.

Size the embed box to fit the counter image so it isn’t clipped or scrollable.

Official documentation: Wix: embedding websites and widgets

Webflow Starter

JavaScript
Documented Custom code in site and page settings (head and footer) requires a paid Site plan. Code Embed element availability has varied by plan, so check current limits.
Image counter
Test first Webflow’s Image element expects uploaded assets. An external counter image normally needs a Code Embed with an <img> tag.

Starter sites are served on a webflow.io subdomain. Expect that as the referrer.

Official documentation: Webflow: custom code embeds

Google Sites

JavaScript
Documented “Embed code” places your HTML and JavaScript in a sandboxed iframe on a Google-owned domain, without access to your page or its head.
Image counter
Test first An image inserted “by URL” may be stored or proxied by Google, which would freeze the counter. An <img> inside an Embed code box is the likelier route.

Check on the published site, signed out, whether the number changes between visits.

Official documentation: Google Sites: embed HTML and JavaScript

Neocities

JavaScript
Documented You upload your own static HTML, CSS and JavaScript files, so you control the markup directly. Free accounts have limits on uploadable file types and storage.
Image counter
Test first A plain <img> tag pointing to a counter server is ordinary HTML, but confirm the external resource loads on your live page.

The classic home of hand-made personal sites. Both counter types fit the culture.

Official documentation: Neocities: account features

Blogger / Blogspot

JavaScript
Documented The “HTML/JavaScript” gadget in Layout and the theme HTML editor both accept custom code, including scripts.
Image counter
Test first Works in a gadget or in a post’s HTML view. Images added through the post editor’s upload tool become copies, so paste the <img> tag in HTML view.

A sidebar gadget shows the counter on every page without editing each post.

Official documentation: Blogger: HTML/JavaScript gadgets

Netlify

JavaScript
Documented You deploy your own files, so scripts, images and HTTP headers are fully under your control, including any Content Security Policy you set.
Image counter
Documented Any HTML you deploy is served as written. If you add a Content Security Policy, allow the counter’s domain in img-src or script-src.

On a host like this you can pick either type based on what you want to measure.

Official documentation: Netlify: deploy documentation

Online forums (BBCode)

JavaScript
Documented BBCode has no script tag. Forum software escapes user HTML in posts and signatures as a basic security measure.
Image counter
Test first [img] works where images are allowed in signatures. Many forums (XenForo and Discourse, for example) can proxy or cache external images, which reduces counting accuracy.

Read the forum’s signature rules. Size limits are common, and some communities ban counters outright.

Official documentation: phpBB: BBCode guide

03

How visitor counters work

Every counter answers one question: how many times did something reach the server? The approaches differ in what that “something” is and how much context comes with it.

1 Visitor’s browser loads your page’s HTML
2 Page asks for the counter IMG image request, or JS script request
? Cache or proxy may answer with a stored copy. Not counted.
3 Counter server records a hit and updates its total
4 Response an image with the number, or data the script displays
Simplified request flow. Only requests that pass through any cache or proxy and reach the counter server (step 3) are counted.

Traditional image counters

The counter is an image URL. When the browser fetches it, the server adds one to the total and generates a picture of the current number, often in a retro digit style. This needs no code on the page and is the oldest approach on the web.

JavaScript-assisted counters

A small script runs in the visitor’s browser, collects context such as the page path, referrer and screen size, and sends it to the counter server. The script then displays the number as text or an image. More information, more requirements.

Server-side analytics

Your own web server or host logs every request it serves. This needs nothing on the page and isn’t affected by content blockers, but it counts bots too, and it’s only available where you can read the logs or the host provides statistics.

Hits, image requests and pageviews

A hit is an HTTP request for a resource; one webpage can generate many hits. An image request is a hit for the counter image. A pageview is a page being viewed, which an image counter can only estimate from requests that reach its server. Unique visitors estimate distinct browsers or people over a defined period.

Unique visitors

An estimate of how many distinct people or browsers visited. It’s calculated with cookies, browser storage, or by combining IP address and browser details over a time window. Shared networks, multiple devices and cleared cookies all distort it.

04

No-JavaScript counters

An HTML-only counter is just an image whose address points to a counter server instead of a file. The server counts the request and sends back a picture of the current number.

What happens, step by step

  1. You place an image tag on your page. Its src points to a counter service and usually contains an ID for your counter.
  2. A visitor opens the page and their browser requests the image, like any other image.
  3. The counter server receives the request, adds one to your counter (sometimes after filtering obvious bots or repeat requests), and generates an image showing the new total.
  4. The server sends headers asking not to cache the image, so the next view triggers a fresh request.
Illustrative examples only. The address counter.example is a reserved placeholder domain. These snippets show the general shape of an image counter. They aren’t working code for any particular service, and don’t announce any service endpoint. Use the exact snippet your chosen counter provider gives you.
HTML · Illustrative, not functional
<!-- Illustrative example – not a real endpoint -->
<img src="https://counter.example/c/YOUR-ID.svg"
     alt="Visitor counter"
     width="88" height="31"
     loading="eager"
     referrerpolicy="no-referrer">
BBCode · Illustrative, not functional
[url=https://my-homepage.example/]
[img]https://counter.example/c/YOUR-ID.png[/img]
[/url]

The example uses referrerpolicy="no-referrer" to avoid sending the page URL in the Referer header. Without that attribute, browsers generally send the site origin to an HTTPS counter on another origin, depending on site policy. The counter ID is fixed; no full page URL is added to the image address. Use loading="eager" if the counter should load immediately.

Caching

Counter servers send headers like Cache-Control: no-store so each view triggers a new request. Most browsers honor them, but some intermediaries don’t. The back button and “restore tabs” can also show the page without fetching the image again. Some services add a changing parameter to the URL, which only works when the page itself is generated per view.

Forum image proxies

To protect members’ IP addresses and avoid mixed-content warnings, many forums fetch external images through their own proxy. The proxy may fetch the image once and serve the same copy for hours or days. The counter then sees the proxy, not the readers, and may barely move.

Privacy considerations

Any external image reveals the visitor’s IP address, user-agent and often the referring origin to the server hosting it. That’s true of every embedded image, not just counters. Choose a provider whose privacy information you have read, and consider whether your site needs to mention the counter in its own privacy notice.

Limitations

Image counters miss visitors who block images or third-party requests, and can be inflated by crawlers, link-preview bots and email prefetchers. They can’t record time on page, scroll depth or which link someone clicked. For a sense of popularity they’re fine; for decisions that matter, use more data.

05

Frequently asked questions

Can I count visitors without JavaScript?

Yes. An HTML image counter is a normal <img> tag whose source is a counter server. Each time a browser requests that image, the server records a hit and returns an image. It works wherever external images are allowed, but it counts image requests that reach the server, not every pageview.

Does an HTML image counter work on WordPress.com?

On WordPress.com plans that don’t allow plugins or custom code, scripts are removed from posts and widgets, but external images can usually be inserted by URL or in a Custom HTML block. Whether the counter increments on each view needs testing, because WordPress.com may serve external images through its own image service, which caches them.

Can I use a visitor counter in a forum signature?

Often, if the forum allows [img] BBCode in signatures. Check the forum rules first: many limit image size or ban counters, and many forums route external images through an image proxy, which caches the image and hides the reader’s details from the counter server.

How do hits, image requests, pageviews and unique visitors differ?

A hit is one HTTP request for a resource; one pageview can generate many hits. An image request is a hit for the counter graphic, not necessarily a pageview. A pageview means a page was viewed, and counters can only estimate this from the requests they receive. Unique visitors estimate distinct browsers or people during a defined period, using methods such as cookies or pseudonymous technical signals; all methods have limitations.

Why do image counters sometimes miss visits?

The counter only sees requests that reach its server. Browser caches, CDNs and forum or email image proxies can serve a stored copy instead; content blockers and data-saving modes can block external images; and some readers never load images at all. Bots and link previews can also add hits that aren’t real visits.

Do website counters use cookies?

It depends on the service. Some counters set cookies or use browser storage to estimate unique visitors; others use none and count raw requests or hashed technical data. Read each provider’s privacy information, and check your own legal obligations, since whether a notice or consent is needed depends on what is collected and where you and your visitors are.

Can a visitor counter work on a free website?

Usually, yes. Free static hosts such as Neocities and Netlify let you add either kind of counter. Free website-builder plans often block JavaScript, so an image counter or the platform’s own statistics may be the only options. Test on a published page, because editor previews behave differently.

06

Further resources

Background reading on the web standards behind visitor counters, plus one example service.

Example service

counter.gratis

If you want a ready-made counter, counter.gratis is a free visitor counter service you can add to a website with an embed snippet. Check its site for the embedding methods it currently supports and what it collects. This guide doesn’t assume an HTML-only image option is available there. Compare it with other providers before choosing.

Disclosure: Website Counter Guide is affiliated with counter.gratis. It’s mentioned here as one example, not as the only or best option. Nothing on this site is a paid placement for other services.

Reference material