Asset Count

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>


Package Name

To install this plugin, search for its package name on the Plugin Store and click “Install”.


  • Version 1.0.3
  • Last Update 11/18/2020
  • Active Installs 40
  • Compatibility Craft 3
  • License MIT
  • Categories Templating, Assets, Utilities

Report an issue