How to Add a Total Views Counter to Your WordPress Posts

Ben Sibley
Independent Analytics
5 min readFeb 16, 2023

Want to show off your stats?

There’s no better way than adding a simple view counter to all your posts and pages.

But view counters aren’t only for showing off…

If you sell advertising space or product reviews, displaying the number of visits your posts get can be a great way to soft-sell your services. Once an advertiser sees your traffic, they’ll be more likely to reach out to discuss pricing and details.

Now that you know how valuable this small change can be, let’s cover how a view counter can be added to your WordPress website.

What the counter will look like

Before we dive into the tutorial, here’s a quick look at what the view counter will look like:

You’ll be able to display the counter before and/or after your post content, and there’s a shortcode if you’d like to output it in a custom location.

Now let’s get into the step-by-step.

Install a view counter plugin

The first step to adding the view counter is to install the Independent Analytics plugin.

Independent Analytics is a lightweight alternative to Google Analytics and will track all your site’s views and visitors. It’s easy to install and doesn’t require any configuration.

And, of course, it includes a public view counter that can be enabled on your site!

You can download Independent Analytics from our site or install it through your WP admin dashboard. Just search for it by name in the Plugins > Add New menu, and you’ll see it appear immediately.

Once installed, you’ll find a new Analytics menu item that will open your full dashboard.

From this dashboard, you can find out which pages people are viewing, what traffic sources are sending people to your site, and what cities they’re visiting from.

While you may not need an entire analytics dashboard, this data needs to be recorded regardless so that you can display accurate visit counts on the front end of the site.

Speaking of which, let’s cover how to display the view counter now.

How to display the view counter

To add the view counter to your site, start by visiting the Settings menu in the analytics dashboard.

Next, scroll down the page until you see the Public View Counter settings, which look like this:

To start displaying the view counter like the one pictured earlier, just check the Enable the view counter box and save the settings. The counter will display automatically across all posts on your site.

As you can see from the screenshot above, you can also choose to output the counter on pages and media (image attachment pages). If you have a custom post type, it will show up here too.

Customizing the view counter

By default, the view counter shows up after the content, but you can display it before and/or after.

Besides customizing the location, you might also want to edit how it looks. Two simple options are available for changing the text and toggling the icon display.

If you’d prefer to display it in a custom location, you can use the shortcode, which looks like this:

[iawp_view_counter]

The shortcode will automatically use the settings you have configured, but you can also override them by entering custom values like this:

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

Whether you’re outputting the counter automatically or manually in a few places, it should only take a few minutes to get it fully configured.

Alternative view counter plugins

Independent Analytics is an awesome plugin to add view counters to your site and get a full analytics dashboard.

However, if you’d prefer to use a plugin that only adds a view counter, you might like the Post Views Counter plugin. It’s the most popular plugin made specifically for this purpose.

That plugin has similar options for outputting the counter but has a much more limited dashboard that only shows you your total visits and doesn’t include visits per page, traffic sources, filtering, or sorting.

Another option is the WP Post Views plugin, which is even simpler. It includes a shortcode to manually place the counter anywhere you want on your site. It does not include a dashboard showing overall visits to your site.

Enjoy your new view counter

Now you can see how easy it is to add a view counter to WordPress with the right plugin.

While you may not have planned on getting an entire analytics suite for your site, Independent Analytics is simple to use and won’t slow down your site.

Download Independent Analytics

If you want an even smaller plugin, you may want to try one of the two alternatives mentioned above.

Thanks for following this guide on adding a post view counter to your WordPress website, and don’t hesitate to drop a comment below if you have any questions.

Originally published at https://independentwp.com/blog/add-post-view-counter-wordpress/ on February 16, 2023.

--

--