Social proof can persuade your visitors to take specific actions on your WordPress website. A slight nudge in the right direction can boost website engagement.

For instance, if visitors see a popular post, they may feel tempted to read it. You can show popularity by displaying the total views on the post. That way, visitors catch a case of FOMO and will engage with your content.

Lifehacker example WordPress post views

Source: Lifehacker

There are two ways to display total views on a WordPress post. The first method requires some technical know-how, while the other method requires no coding skills. Let’s get started. 

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Displaying Post Views Without A Plugin

If you feel comfortable editing code, you can display your post views with a few changes to your theme files. Follow the instructions below.

  • Log in to your WordPress dashboard.
  • Go to Appearance > Theme Editor.
  • Open the functions.php file.
  • Copy and paste the following code before the closing tag ?>:

 

function gt_get_post_view() {

    $count = get_post_meta( get_the_ID(), 'post_views_count', true );

    return "$count views";

}

function gt_set_post_view() {

    $key = 'post_views_count';

    $post_id = get_the_ID();

    $count = (int) get_post_meta( $post_id, $key, true );

    $count++;

    update_post_meta( $post_id, $key, $count );

}

function gt_posts_column_views( $columns ) {

    $columns['post_views'] = 'Views';

    return $columns;

}

function gt_posts_custom_column_views( $column ) {

    if ( $column === 'post_views') {

        echo gt_get_post_view();

    }

}

add_filter( 'manage_posts_columns', 'gt_posts_column_views' );

add_action( 'manage_posts_custom_column', 'gt_posts_custom_column_views' );

  • Open the single.php file. Copy and paste this code in the while loop (press CTRL + F or Command + F to find it in the file):

 

<?php gt_set_post_view(); ?>

  • Copy and paste this code where you want to show the number of views:

 

<?= gt_get_post_view(); ?>

  • Your post will look like this:

example of WordPress post views

Source: GretaThemes

Displaying Post Views With A Plugin

WordPress plugins are available to help you display total post views. We recommend using one of the following tools. 

1. Post Views Counter

Post Views Counter is a well-known, reliable plugin. You can display how many times a post, page, or any custom post type has been viewed. The tool can pull data via four ways: PHP, Javascript, Fast AJAX, and REST API. In the plugin’s display settings, you can determine the style and position of the counter.

post views counter plugin for WordPress post views

Source: WordPress.org

You also can exclude counts by certain visitors, like bots, logged in users, or selected user roles. In return, you’ll get a more accurate count of your visitors’ behavior.

2. Easy Post Views Count

Easy Post Views Count is another simple plugin for displaying your total views on posts. You can even enable (or disable) specific post types. Here’s an example of how it will appear on your website: 

easy post views count plugin for WordPress post views

Source: WordPress.org

It supports a shortcode, making it easier to add the views to your post. The developers of the plugin also offer email support if you need additional assistance. 

3. Simple Post Views Count

Simple Post Views Count lives up to its name. With a quick setup process, you can use shortcode or PHP to display your post views. This plugin outshines the rest because it counts a post view only after a visitor spends eight seconds on your page. You also can adjust the specific time duration. 

simple post views count plugin for WordPress post views

Source: WordPress.org

Tracking Beyond Total Post Views

While displaying total post views is an effective tool for social proof, it doesn’t provide the full story of your content’s performance. You need a robust dashboard to monitor top posts and track conversions. Check out these platforms to learn more about your website analytics.

  • Google Analytics + gives you an overview of your website activity in the WordPress dashboard. You can track page views, visits, and bounce rates. You also can analyze your data with easy-to-read graphs.
  • Monster Insights offers universal tracking setup across multiple devices and campaigns without any code. You’ll see real-time stats of who is online and what they are doing. Plus, you get page-level analytics to identify your most popular posts and pages.
  • Jetpack is a suite of security, performance, and site management tools. It offers a Google Analytics integration to optimize your visitors’ behavior. You can explore detailed insights on traffic and search results.

You can persuade visitors to take action on your website by displaying your WordPress post views to increase your content engagement. To dig deeper into your stats, install an analytics platform.

Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

 Use HubSpot tools on your WordPress website and connect the two platforms  without dealing with code. Click here to learn more.

Originally published Sep 19, 2019 4:36:15 PM, updated November 20 2019

Topics:

WordPress Website