Entry Count Logo Entry Count

Count and display entry views.

The Entry Count Plu­gin was built spe­cific­ally for train­ing pur­poses and is used in the Craft Plu­gin Devel­op­ment video course.

It allows you to count and dis­play the num­ber of times that an entry has been viewed in Craft CMS.

License #

This plu­gin is licensed for free under the MIT License.

Require­ments #

Craft CMS 3.0.0 or later.

Install­a­tion #

To install the plu­gin, search for Entry Count” in the Craft Plu­gin Store, or install manu­ally using composer.

composer require putyourlightson/craft-entry-count

Twig Tags #

count(entry.id)

{% set count = craft.entryCount.count(entry.id) %}

Entry count: {{ count }}
First count: {{ count.dateCreated }}
Last count: {{ count.dateUpdated }}

entries

{% set entries = craft.entryCount.entries.all() %}

{% for entry in entries %}
    {% set count = craft.entryCount.count(entry.id) %}
    {{ entry.title }} ({{ count }} views)
{% endfor %}

increment(entry.id)

{% do craft.entryCount.increment(entry.id) %}

Plu­gin icon by Made by Made from the Noun Project