Skip to content
A Craft CMS plugin to track the number of views for assets.
Branch: craft-3
Clone or download
Latest commit 9ed6e05 Jan 17, 2020
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github version 1.0.0 Jan 12, 2020
src Craft 3.4 work Jan 17, 2020
.gitignore version 1.0.0 Jan 12, 2020 version 1.0.0 Jan 12, 2020
config.codekit3 Craft 3.4 work Jan 17, 2020

Asset Count for Craft CMS

A Craft CMS plugin that allows you to count and display the number of times that an asset has been viewed.

In order to count a directly accessed Asset, you will need to alter the url that the asset points to. This is so that the view is tracked before presenting the user with the original asset as intended.

So, instead of a link to the asset such as:

<a href="{{ file.url }}" target="_blank"></a>

You'll need to change it to:

{% set file = %}

<a href="{{ actionUrl('asset-count/count', { id: }) }}" target="_blank"></a>

// Or with Twig filter
<a href="{{ file | asset_count }}" target="_blank"></a>

// Or with Twig function
<a href="{{ asset_count(file) }}" target="_blank"></a>


You can install Asset Count via the plugin store, or through Composer.

Craft Plugin Store

To install Asset Count, navigate to the Plugin Store section of your Craft control panel, search for Asset Count, and click the Try button.


You can also add the package to your project using Composer.

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
  2. Then tell Composer to load the plugin:

     composer require verbb/asset-count
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Asset Count.

Show your Support

Asset Count is licensed under the MIT license, meaning it will always be free and open source – we love free stuff! If you'd like to show your support to the plugin regardless, buy us a 🍻. Please note that this does not entitle you to any form of support, and is completely optional.


Credit & Thanks

Thanks to Ben Croker for the Entry Count Plugin.

You can’t perform that action at this time.