PHPackages                             coysh-digital/craft-download-tracker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. coysh-digital/craft-download-tracker

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

coysh-digital/craft-download-tracker
====================================

Lightweight, static-cache-friendly download tracking for Craft CMS - counts downloads per file with an atomic counter (no element-per-download bloat).

1.4.0(4w ago)017proprietaryPHPPHP &gt;=8.2

Since Jul 3Pushed 1mo agoCompare

[ Source](https://github.com/Coysh-Digital/craft-download-tracker)[ Packagist](https://packagist.org/packages/coysh-digital/craft-download-tracker)[ RSS](/packages/coysh-digital-craft-download-tracker/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (12)Used By (0)

Download Tracker for Craft CMS
==============================

[](#download-tracker-for-craft-cms)

Count how many times each of your files gets downloaded - without bloating your database.

A lot of the download-tracking tools I found wrote a new database row (or even a whole element) for **every single download**. On a busy site that table balloons into millions of rows and starts to hurt, I found that sites that had static caching enabled were refreshing the cache constantly. Download Tracker takes the opposite approach: it keeps **one running counter per file** and increments it atomically. A file downloaded a million times is still a single row.

It's also built for modern, cache-first Craft sites. If you run full-page static caching such as [Blitz](https://putyourlightson.com/plugins/blitz), you'll know that a cached page never touches PHP - so anything that tries to "count on page load" simply never fires. Download Tracker sidesteps this entirely by counting on a lightweight background request that static caches always let through.

Features
--------

[](#features)

- **One counter per file.** Atomic `count + 1` updates mean no per-download row explosion and no race conditions, even under heavy concurrent traffic.
- **Daily breakdown.** A compact per-day rollup (one row per file per day) lets you see trends over time, and old rows are pruned automatically.
- **Works with static caching.** Counting happens on a background request, so it keeps working on pages served straight from a Blitz (or similar) cache.
- **Zero-touch setup.** Turn it on and it starts counting your existing download links automatically - no template changes required.
- **Optional managed download links** for gated, private, remote, or force-“Save as…” downloads, using a signed, tamper-proof URL.
- **Reporting built in.** A searchable, sortable Downloads screen in the control panel, CSV export, saved reports, and a “Top Downloads” dashboard widget.

Requirements
------------

[](#requirements)

- Craft CMS 5.0 or later
- PHP 8.2 or later

Installation
------------

[](#installation)

Install with Composer and then enable the plugin:

```
composer require coysh-digital/craft-download-tracker
php craft plugin/install download-tracker
```

Or install it from the **Plugin Store** in your control panel.

How it works
------------

[](#how-it-works)

Downloads are counted through one of two routes, and both update the same counter - so a file is never double-counted.

### 1. Automatic click tracking (the default)

[](#1-automatic-click-tracking-the-default)

With **Auto-track download links** switched on, the plugin adds a tiny script to your front-end pages. When a visitor clicks something that looks like a download

- a link under one of your configured paths, a link to a tracked file type, or any link with a `download` attribute - the script quietly pings the plugin and then lets the browser download the file exactly as it normally would.

You don't have to change any of your templates or links. To exclude a specific link, add `data-dt-ignore` to it.

### 2. Managed download links (optional)

[](#2-managed-download-links-optional)

When you want a download counted reliably on the server - for example a members-only PDF, a file on private/off-server storage, or a link that should force a “Save as…” - route it through the plugin:

```

  Download the brochure

```

The link carries a signed token, counts the download when clicked, and then either redirects to the file (for public assets) or streams it through Craft (for private or off-server assets).

> **A note on private files:** a download link is a bearer link - anyone who has the URL can use it. If you place a managed link to a *private* asset on a *publicly cached* page, that URL gets baked into the cached HTML and becomes a permanent public link. For genuinely private files, turn on **Require login**, and/or set a **Signed URL lifetime** and only render the link on pages that aren't statically cached (such as logged-in account pages).

Reading the numbers in Twig
---------------------------

[](#reading-the-numbers-in-twig)

```
{{ craft.downloadTracker.total(asset) }}   {# total downloads (a number) #}
{{ craft.downloadTracker.record(asset) }}  {# the counter record, incl. last download #}
{{ craft.downloadTracker.top(10) }}        {# the ten most-downloaded files #}
{{ craft.downloadTracker.url(asset) }}     {# a signed, counting download link #}
```

`total()`, `record()` and `url()` all accept an Asset, an asset ID, or a URL/path string.

> **Tip:** avoid printing a live download count directly into a statically cached page - the number would freeze until the cache is regenerated. Show counts in the control panel, or load them with a small client-side request.

Settings
--------

[](#settings)

Everything is configurable in **Settings → Download Tracker**, or in a `config/download-tracker.php` file (which takes precedence, and is handy for per-environment values):

SettingWhat it doesAuto-track download linksInjects the click-tracking script on the front end.Tracked path prefixesURL paths whose links should be counted, e.g. `/assets/files/`.Tracked extensionsFile types to treat as downloads (`pdf`, `zip`, `csv`, …).Track download-attribute linksAlso count any link with a `download` attribute.Excluded hostsHostnames to ignore, e.g. an image CDN.Track non-asset filesAlso count links that don't resolve to a Craft asset. Off by default.Ignore prefetch &amp; botsSkip browser prefetch/prerender and obvious crawlers.Serve modeHow managed links deliver files: redirect, stream, or auto.Force downloadServe managed downloads as an attachment (“Save as…”).Require loginOnly serve managed downloads to logged-in users.Signed URL lifetimeHow long a managed download link stays valid (0 = forever).Daily rollup retentionHow many days of per-day history to keep.Support
-------

[](#support)

Found a bug or have a request? Please open an issue on [GitHub](https://github.com/Coysh-Digital/craft-download-tracker/issues).

License
-------

[](#license)

This plugin is commercial software, released under a commercial license. See [LICENSE.md](LICENSE.md) for details.

Made by [Coysh Digital](https://coysh.digital).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance93

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

9

Last Release

28d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5764356?v=4)[Tim Coysh](/maintainers/Coysh)[@Coysh](https://github.com/Coysh)

---

Top Contributors

[![Coysh](https://avatars.githubusercontent.com/u/5764356?v=4)](https://github.com/Coysh "Coysh (4 commits)")

---

Tags

blitzcraft-cmscraft-plugincraftcmsdownload-trackerdownloadsphpcmsdownloadsassetsanalyticsCraftcraftcmscraft-pluginblitzdownload-tracking

### Embed Badge

![Health badge](/badges/coysh-digital-craft-download-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/coysh-digital-craft-download-tracker/health.svg)](https://phpackages.com/packages/coysh-digital-craft-download-tracker)
```

###  Alternatives

[verbb/formie

The most user-friendly forms plugin for Craft.

101400.6k79](/packages/verbb-formie)[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.5M73](/packages/nystudio107-craft-seomatic)[verbb/hyper

A user-friendly links field for Craft.

24153.5k14](/packages/verbb-hyper)[verbb/vizy

A flexible visual editor field for Craft.

4251.5k1](/packages/verbb-vizy)[verbb/comments

Add comments to your site.

13754.0k1](/packages/verbb-comments)[verbb/events

A full-featured plugin for event management and ticketing.

2312.1k](/packages/verbb-events)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
