Ajouter

Lorem ipsum

Lorem ipsum

CRO / Conversion

8 views

4 min

How to Display a View Counter on Webflow Articles

Learn how to display a view counter on your Webflow articles with the free CountAPI.

In this tutorial, Sandro, cofounder of the Gemeos Webflow agency, shows you how to display a view counter on your Webflow articles with CounterAPI

Example

View counter for this article

👁 Loading...
ServiceCostLimitPersistence
CountAPIFreeUnlimitedPermanent
Hits CounterFreeUnlimitedPermanent
Vercel KV customPaid/freeDepending on planPermanent

Understanding CounterAPI

CounterAPI is a free service that exposes a simple REST API for incrementing and reading counters. Each counter is identified by a namespace and a key. The /v1/namespace/key/up call increments the counter and returns the current value in a single request.

1. Add a Text Block to display views

In Webflow, create a Text Block with the ID view-count where you want to display the view count (article header, near the date...).

2. Set a unique key for each article

Each article needs a unique key. The script automatically uses the URL slug as the key: /academy/mon-article becomes academy-mon-article. No manual setup needed.

3. Add the script in Footer code

Replace gemeos with your own namespace in the script. The namespace keeps your counters separate from other CounterAPI users.

(function() {
var el = document.getElementById('view-count');
if (!el) return;

var key = window.location.pathname.replace(/\/\//g, '-').replace(/^-|-$/g, '') || 'home';
var namespace = 'gemeos'; // Replace with your namespace

fetch('https://api.counterapi.dev/v1/' + namespace + '/' + key + '/up')
.then(function(r) { return r.json(); })
.then(function(data) {
var count = data.count || 0;
el.textContent = count.toLocaleString('fr-FR') + ' view' + (count > 1 ? 's' : '');
})
.catch(function() {
el.textContent = '';
});
})();

4. Read-only mode (no increment)

To display the counter without incrementing it (in preview or for admins), use /get instead of /up:

fetch('https://api.counterapi.dev/v1/' + namespace + '/' + key + '/get')

good to know

CounterAPI doesn't require authentication, which means anyone can increment your counters by calling the API directly. For accurate view counters on a high-traffic site, go with an authenticated solution (Vercel KV, Supabase) or Google Analytics via the Reporting API. CounterAPI is ideal for sites with moderate traffic where an approximation is enough.

Conclusion

CounterAPI is the fastest way to display views on Webflow without a backend. Use cases:

  • View counter on blog articles
  • Popularity of resources in a library
  • Social proof on landing pages ("already viewed 1,240 times")

Published on

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...