How to Add a Post View Counter to WordPress

Disclosure: This post may contain affiliate links. Purchasing a product through one of these links generates a commission for us at no additional expense to you.

Ready to show off your site’s popularity?

Adding a post view counter to WordPress is easy with the right plugin.

In this tutorial, you’ll learn how to record the number of views your site gets and display a counter that shows these values publically on your site.

You’ll be able to show the counter automatically across all your posts and/or pages or output it manually in a sidebar, or anywhere else you’d like.

Let’s dive in with step #1 now.

Install Independent Analytics

One of the best ways to add a view counter to your site is with the Independent Analytics plugin.

Independent Analytics plugin

Independent Analytics is a privacy-friendly alternative to Google Analytics and doesn’t require an account or any configuration to use.

It adds a complete analytics dashboard to your WordPress admin, where you can see how many views and visitors each post received.

Free Full

It also includes a simple view counter that you can display publically on your site, which looks like this:

View Counter Example

Why you should use Independent Analytics

You might be wondering why you should install an entire analytics plugin for a post views counter.

Well, here’s the thing…

The view counter needs to get the data from somewhere, and currently, there aren’t any view counter plugins that source their data from Google Analytics or any other analytics platform. This means each view counter plugin is recording analytics itself.

In other words, if you’re going to add a plugin that counts visitors and displays a counter, you may as well use one that also includes a full analytics dashboard.

Now that we’re on the same page, here’s how you can display the view counter on your site.

Display the view counter

With Independent Analytics, you can display the view counter in two ways: automatically across page types or manually via a shortcode.

Enable the automatic display

The view counter can be enabled automatically across your site in a few easy steps.

Start by visiting the Analytics > Settings menu and scroll down to the view counter section.

Public View Counter Settings

Next, check the post types where you’d like to display the view counter.

View Counter Post Types

Then you can decide if you’d like the view counter to show up before, after, or before and after the page content.

Counter Location

Lastly, you can customize the text next to the count and toggle the icon on/off.

View Counter Label Icon

Once you’re happy with your settings, check the box at the top to enable the view counter, and then save your settings.

Enable View Counter

You’ll now see the view counter show up across your entire site on whichever page types you selected.

Output manually with a shortcode

If you don’t want the view counter to display before or after the page content, you can output it manually with the shortcode.

The great thing about the shortcode is that it can be added to a widget, block, or in an element created by a page builder like Elementor or Divi.

Here’s an example of the shortcode, which is also included in the settings menu:


The view counter will appear wherever you add this shortcode on your site.

It uses the settings you defined already, but you can override the icon display and the text manually with parameters like this:

[iawp_view_counter label="Views:" icon="1"]

You can show/hide the icon by setting its value to 1/0, respectively, and the label parameter contains the text that displays before the view count.

Alternative view counter plugins

If you’d prefer to use another plugin, we have additional recommendations here:

The 7 Best Post View Counter WordPress Plugins

Post View Counter Plugins

There are some excellent plugins in that collection, including some with more customization options than in Independent Analytics.

Can you display view counts without a plugin?

Displaying a view counter without a plugin isn’t possible. You can’t type it in manually because you need PHP to fetch the view count for the current post and display this dynamic value.

And whenever you need to add new functionality (PHP) to your site, that means adding a new plugin.

However, you can use fewer plugins by installing Independent Analytics instead of installing one plugin for your analytics and another for your view counter.

Enjoy your new post view counter

To display a view counter on your site, you need a way to get the number of views each post has and output it on your site.

All of the available plugins record views themselves, so it makes more sense to use Independent Analytics, which includes a robust analytics dashboard in addition to the view counter.

Learn more about Independent Analytics

I hope this tutorial on how to add a post view counter to WordPress helped you out today, and if it did, please use the buttons below to share it with someone else who might enjoy it.

Ben Sibley
Ben Sibley
Ben Sibley is a WordPress theme designer & developer, and founder of Compete Themes.