Voux

Counters

How counters work and how to customize them.


Overview

The counter is the main feature of Voux. It simply counts views.

You can create a counter either from the main page (if the instance is public) or from the dashboard if you are logged in.

When creating a counter, you can choose between 2 modes:


Unique visitors

This mode counts only one visit per IP.

If the same IP visits the page again, it will not increase the counter. This is useful if you want something closer to "real" visitors.


Every-visit

This mode counts every page load and stores the visitor IP.

Refreshing the page will increase the counter each time, depending on the throttle setting. By default, the throttle is 0s, meaning every refresh counts. The IP is only used for throttling and stats, not to prevent counting.

You can think of this like an old-school hit counter from early web days.


After creating a counter, Voux gives you both an embed script and an SVG embed. Once you place it on your website, views will start counting automatically.

From the dashboard, you can also edit counters, add notes, and use filters to manage them.

Styling script embeds

Styling your counter with Voux is super simple.
All you need to do is wrap the embed inside an element.

Here is a basic example using a <span>:

HTML
<span class="counter-widget">
  <!-- replace this with your counter script -->
  <script async src="https://your-domain/embed/abc123.js"></script>
</span>

Once that is in place, you can style it however you want using normal CSS.

Here is a simple example that centers the counter on the screen and makes the text black:

CSS
.counter-widget {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: black;
  font-weight: 600;
  font-size: 3rem;
  font-family: system-ui, sans-serif;
}

That is it. Your counter is now styled and ready to use. You can change the font, colors, size, or layout however you like.


Styling SVGs embeds

Voux also provides an SVG embed for cases where you cannot use JavaScript, such as READMEs, Markdown files, or restricted platforms.

HTML
<img src="https://your-domain/embed/abc123.svg" alt="Voux counter">

You can also customize the SVG by passing parameters in the URL query string:

HTML
<img src="https://your-domain/embed/abc123.svg?bg=F54927&color=ffffff" alt="Voux counter">
ParameterValues / RangeDescription
label0 1Show or hide the label
inline0 1Place label and value on the same line
wrap0 1Allow text wrapping. Default off when inline=1
alignleft center rightText alignment
size1248Base size for label and value
sizeValue1248Override value text size
sizeLabel1248Override label text size
maxWidth160900Max width of the SVG
colorhexBase text color
valueColorhexOverride value color only
labelColorhexOverride label color only
bghexBackground color
radius024Background corner radius
padX464Horizontal padding
padY464Vertical padding

SVGs in documentation

Some documentation pages do not allow JavaScript, for example when writing in MDX or other restricted formats. In these cases, SVG embeds are used instead.

Because documentation pages are served without image proxy caching, Voux can access real visitor IPs, so Unique Visitor mode works correctly.

ModeBehaviorExample
👤 Unique visitorsSupported
🔁 Every visitSupported and updates on refresh (reload the page to see it update)

And... On GitHub, Unique Visitors are not available due to image proxy caching. :(

 

Edit on GitHub

Last updated on