rows of numbered keys on an old adding machine
Photo by Lucas van Oort on Unsplash

it doesn't look like anything to me

Recently whilst writing up some new case studies I had the idea of making some of the scorecard figures count up from zero to reach the final figure. Not a new idea, we’ve all seen them, it’s just something that’s appeared on enough homepages and in case studies for it to be engrained in my brain as a sort of convention (or trope). There’s probably some deep psychological reason we like watching numbers go up:

  • Where will it stop?
  • Will the end number be big?
  • Oh wow, it’s still going!
  • A big number means success, success equals money, and money equals happiness.
  • and so on…

0 years warranty as standard

It was whilst testing ways to implement the counter that I found a fun little quirk that could end up doing the opposite of what you wanted. Most of these counters use JavaScript, and it’s important to know what your website looks like to things that don’t process JavaScript - which is most crawlers other than Google’s and Bing’s. For some sites, that can mean a significant amount of core content can’t be seen, because it doesn’t appear in the standard HTML.

This is a problem if your goal is visibility in AI responses - as that JavaScript-only info is invisible to the crawlers for AI assistants like Claude and ChatGPT.

With counters however, there’s an added layer of jeopardy - often the part that is visible in the code is the starting value, before any script has run - and that number is likely zero.

Let’s say you want to show your generous 5 year standard warranty, much better than your competitors. Here’s the HTML:

<p class="stat">
  <span class="counter" data-target="5">0</span> years warranty as standard
</p>

and then here’s the script that makes it count up from 0 to 5:

<script>
  document.querySelectorAll('.counter').forEach((el) => {
    const target = Number(el.dataset.target);
    let current = 0;
    const tick = setInterval(() => {
      current += 1;
      el.textContent = current;
      if (current >= target) clearInterval(tick);
    }, 200);
  });
</script>

There are lots of ways to build a counter, but most work on the same idea: a starting number in the HTML that a script then changes.

So in the example above, read by a non-JS crawler, the HTML effectively says: “0 years warranty as standard”. Imagine somebody using ChatGPT to find a supplier, and they’re weighing up options and although the human-visible counter on your website actually says “5 years warranty as standard” - the AI reply might instead relay: “Their products don’t come with a warranty as standard”.

What visitors see
What a non-JS crawler reads
The same stats as a visitor sees them once the count-up has run, and as a crawler that doesn’t run JavaScript reads them (mock-up).

With an LLM that relies on a non-JS crawler that sees the starting point of “0”, or no number at all - it might be smart enough to realise no company would put “0% increase in revenue” as a result on their homepage, or see the blank and ignore it.

Et tu, Google?

The plot thickens ever more when we take Google into account - its crawler can render JavaScript, which might actually be worse for this case. This is important as what that crawler sees feeds into AI Overviews, AI Mode and Gemini.

With Googlebot, its renderer captures a snapshot of the page - reported to be a few seconds after the JavaScript has been executed. So depending on the speed of your counter and the number it’s reaching, the snapshot could catch it early - meaning your “91% customer satisfaction rate” is actually captured a few seconds into counting up saying “13% customer satisfaction rate”.

The snapshot catches the count at 13%, while visitors watch it carry on to 91% (mock-up).

I experimented with this by using Google’s Rich Results Test - which uses Google-InspectionTool rather than its main Googlebot crawler - but it does render JavaScript, so it’s useful to test - but don’t treat it like the same thing.

The test showed that a counter which showed an empty starting value was actually captured at 0% - the very first number added by the script. So Google can get it wrong two ways: it catches the counter mid-count, or it catches it before it starts.

Et tu, CSS?

You might think that good old CSS has your back. It can count up on its own, no JavaScript needed, and CSS-Tricks has a walkthrough. Sadly it has the same problem, with a twist: the animated digits are added by CSS rather than written in the HTML, and Google has said it doesn’t index text added that way. No crawler sees a wrong number, but none sees the right one either, Google included.

can we fix it?

Yes, we can!

put the figure in the HTML

The most basic way to circumvent this is to make sure that important info is also in the HTML - simply making sure the correct figure is available somewhere outside of a script, preferably appearing before the counter version and higher in the code.

start on the real figure

Remember the 0 in the example HTML? Swap it for the real number:

<span class="counter" data-target="5">5</span> years warranty as standard

Now a crawler that doesn’t run JavaScript reads “5 years warranty as standard”. Job done for ChatGPT and Claude.

Google is trickier. To count up from 0, the script has to set the number back to 0 first, and when it does that is what matters:

  • As the page loads: Google catches the 0, and you’re back where you started.
  • When the counter scrolls into view: the count only starts once someone scrolls to it, and in my test Google never set one off. Google keeps the 5.

So hold the reset until the count actually begins. The one catch is a counter near the top of the page, which is in view straight away, starts counting immediately, and can get caught mid-count.

animate a copy

Leave the figure in the HTML as plain text, hide it visually, and animate a copy beside it marked aria-hidden="true", so screen readers skip the copy and read the real figure once. Crawlers get the real number, people get the count-up. It isn’t cloaking: the hidden text is the same figure everyone sees once the count finishes.

This is where CSS redeems itself. Google ignores text that CSS adds, so a CSS counter can’t muddy what Google reads.

<p class="stat">
  <span class="visually-hidden">5</span>
  <span class="count" aria-hidden="true"></span> years warranty as standard
</p>

The first span holds the real figure, hidden on screen but readable by crawlers and screen readers. The second is empty in the HTML: it’s where the CSS draws the count, and aria-hidden stops screen readers reading it out.

Animate the copy with JavaScript instead and its digits are real text again, so Google reads both numbers: the real one, and wherever the count had got to when the snapshot was taken. Catch it two years in and that’s “5 2 years warranty as standard”.

don’t animate the number

Simplest of the lot: don’t animate the number. Fade it in, slide it in, or fill a bar next to it, and leave the figure alone. There’s nothing for a crawler to catch mid-count.

who sees what

Every option side by side, using the 5 year warranty:

visitorsChatGPT, Claude (no JavaScript)Google
JavaScript counter from 050anywhere from 0 to 5
CSS counter only5nothingnothing
figure also in the HTML55, then 05, then 0 to 5
start on the real figure555, unless the count starts first
real figure + CSS copy555
no count-up555

Thanks for stopping by. Add me as a preferred source on Google to see more of my posts in your results.

Add as a preferred source on Google