Description
Want to know how often a post is actually displayed on the actual screen?
This plugin has a javascript that is triggered when the title of a post is displayed in the visible area of the window, either when the page is loaded or when the window is scrolled or resized. It will not be triggered when the post is on the page but stays outside the visual area.
There are two independent counters. The ‘displayed’ counter counts all instances of the post, whether it is in overview pages, search pages or on its own page. The ‘viewed’ counter only counts the post on its own page. Note that ‘viewed’ this also is counted as ‘displayed’.
The ratio between the two values can be used as a metric for the attractiveness of the article title, the excerpt and/or featured images that are displayed in overviews.
Both counters are triggered by javascript. This means that search bots will not trigger the counter. Also the rare cases a user has javascript disabled the counter will not be triggered.
The counter values will by default be displayed above each post on its own page. The plugin has several functions that can be used inside template files for more control.
Acknowledgements
We created this plugin for https://denhaagdirect.nl, a local news and blog website in The Hague, Netherlands. . Thanks Michael and Jeroen for letting us share this plugin.
Screenshots
Installation
In the WordPress backend, search for the plugin ‘post-display-counter’. Once you found it, activate it and you are done. In the plugin options you can choose to hide the counter for all posts and for posts before a certain date. You can also hide the counter for individual posts.
The plugin might not work out of the box for all themes, in that case you will have to modify the theme files. For instructions see below. Also feel free to send us an email, we are happy to help.
Posts are only counted when the title is generated by the_title() function. You can count other instances by modifying the template files.
add a class “countable”
in the same element, add an attribute “data-served-id” with the post id as its value.
For example, change this:
into this:
<h3 class="countable" data-served-id="”>
The reverse could also be needed. When you have a title that should be excluded from being counted, surround it with the functions count_remove() and function count_restore() like this:
<?php function count_remove();
the_title();
function count_restore(); ?>
There are 3 functions that you can use to display the counter on your page in any format you like. In this case you probably want to disable the default counter in the plugin options.
Display default counter:
Display counters in your own format:
This post has been presented times.
This post has been opened times.
The open rate is times.
(note that get_counters() can be used both to display the default counter as to determine if the counter is visible)
FAQ
- I miss feature X
-
Feel free to send us an email, if more people request the same feature we will build it.
Reviews
Contributors & Developers
“Post Display Counter” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Post Display Counter” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0
First publication on 2014 August 4