Guides

How to Show a Live Visitor Counter on Your WordPress Site

Live Traffic Analytics

How to Show a Live Visitor Counter on Your WordPress Site

A live visitor counter in WordPress shows how many people are on your site right now, directly on a public page. Live Traffic Analytics includes a free shortcode that outputs that number as plain text, so you can place it almost anywhere and style it to match your theme. This guide covers where to add it, how caching affects it, and when a public counter actually makes sense.

What the counter shows

The shortcode is 0. It outputs the current active-user count from Live Traffic Analytics as text. That is the same “active users” figure you see at the top of Traffic Analytics → Overview: people active on the site within a recent time window, not a lifetime total.

Because it outputs only the number, you decide the wording around it. You might write “Readers online now:” before it, or place it inside a small banner. The shortcode does not add its own heading or box, which keeps it flexible.

If you want to understand the active-users metric in more depth before showing it publicly, read our guide on how to see live visitors in WordPress or the active users feature page.

Before you add it: decide if a public counter fits

A visitor counter is easy to add, but it is worth pausing to ask whether it helps your readers. A number on a page sends a message, and that message depends on the number.

Where a counter can make sense

  • Live events and launches. A product launch page, live blog, or webinar landing page where activity is part of the experience.
  • Community sites. Forums or membership sites where “others are here too” encourages participation.
  • Internal or team pages. A private page for your team to glance at during a campaign.
  • Transparency. Some creators simply like sharing that people are reading.

Where it may not help

  • Quiet sites. A counter that often reads 1 or 2 may not give the impression you want.
  • Serious or sensitive topics. A live number can feel out of place on medical, legal, or support pages.
  • Pages you cache heavily. More on that below.

There is no right answer. Pick pages where the number adds something for the reader, and leave it off the rest.

How to add the shortcode

Install and activate Live Traffic Analytics from WordPress.org first. The counter only reflects visits the plugin records, and reports start from visits recorded after installation.

In the block editor (posts and pages)

  1. Open the post or page you want to edit.
  2. Click the + inserter and add a Shortcode block.
  3. Type 0 into the block.
  4. Add a Paragraph block before it with your label, such as “Visitors online right now:”.
  5. Update or publish, then view the page on the front end.

Shortcodes also work inside many paragraph contexts, so you can try writing the label and shortcode in the same sentence. If it does not render there in your theme, use the dedicated Shortcode block.

In a widget area or sidebar

  1. Go to Appearance → Widgets (on classic or hybrid themes).
  2. Add a Shortcode block to the sidebar or footer area.
  3. Enter 0 with a short heading above it.
  4. Save and check the front end.

In a block theme template

  1. Go to Appearance → Editor and open the template or template part you want, such as the header or footer.
  2. Insert a Shortcode block where the counter should appear.
  3. Enter the shortcode, add your label, and save.

Developers working in a classic theme can also output it from a template file with WordPress’s do_shortcode() function. Use a child theme so updates do not overwrite your change.

The caching note you should not skip

Full-page caching saves a copy of each page and serves that copy to the next visitors. That is great for speed. It also means the number printed by the shortcode can be the number from when the page was cached, not the number right now.

If you want the count to stay live, exclude the page that shows the counter from your full-page cache. Most caching plugins and many hosts offer a setting for excluded URLs. Add only the pages that display the counter, so the rest of the site stays fast.

Placement Caching impact Suggested approach
One landing or event page Count may be delayed if cached Exclude that one URL from page cache
Sidebar or footer on every page Count may be delayed site-wide Accept a delayed count, or limit to fewer pages
Private team page Depends on your cache rules Exclude it and restrict access
Header in a block theme Appears everywhere, cached everywhere Consider a single page placement instead

Tip: After excluding a page from cache, open it in a private browser window on your phone and on your laptop. You should see the number change as visits are recorded.

Styling the counter with theme CSS

The shortcode outputs plain text, so styling happens around it. The easiest approach is to wrap the shortcode in something you can target.

  1. Place the Shortcode block (and your label) inside a Group block.
  2. In the Group block settings, open Advanced → Additional CSS class(es) and add a name such as live-count.
  3. Add CSS for that class in Appearance → Editor → Styles → Additional CSS or Appearance → Customize → Additional CSS, depending on your theme.

You can then set font size, weight, color, padding, and a background for the whole group. Block themes also let you change colors and typography directly in the Group block’s style panel without writing CSS. Keep it readable on mobile, and check contrast against your background.

Honest use and expectations

A live counter is a small, friendly signal. It is not a promise of popularity, and it should never be inflated or faked. Show the real number, and if it is often low, consider whether the page needs a counter at all.

Remember that visits to wp-admin are not tracked, and bot activity is separated in the Overview. The public number may also differ from other analytics tools, which use their own rules. For a complete picture behind the number, check Traffic Analytics → Overview and your traffic sources.

If you show visitor information publicly, review your privacy page too. Our guide to privacy friendly analytics in WordPress covers IP anonymization and data retention settings.

Frequently asked questions

Is the live visitor counter shortcode free?

Yes. The 0 shortcode works with the Free plugin. Pro adds visitor-level reports, which you can compare on the pricing page.

Why does the counter not change when I refresh?

Full-page caching is the most common reason. Exclude the page that shows the counter from your cache to get a live count.

Can I change how the number looks?

Yes. The shortcode outputs text, so wrap it in a Group block with a CSS class and style it with your theme’s Additional CSS.

Does the counter include my own admin visits?

No. Visits to wp-admin are not tracked. Viewing the public page itself may count as a visit, like any other visitor.

Add your live counter

A visitor counter takes a few minutes to set up: add the shortcode, exclude the page from cache, and style it to fit. For full setup notes, see the documentation. Then install Live Traffic Analytics free from WordPress.org and add a live visitor counter to your WordPress site.

Free on WordPress.org

See who is on your site right now

Install the free plugin and your first live visit appears in the dashboard within minutes.

Download free plugin