PHPackages                             flipboxfactory/craft-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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. flipboxfactory/craft-tracker

ActiveCraft-plugin[Logging &amp; Monitoring](/categories/logging)

flipboxfactory/craft-tracker
============================

Track various actions such as page views and clicks

013PHP

Since Mar 4Pushed 5y ago3 watchersCompare

[ Source](https://github.com/flipboxfactory/craft-tracker)[ Packagist](https://packagist.org/packages/flipboxfactory/craft-tracker)[ RSS](/packages/flipboxfactory-craft-tracker/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Tracker Integration Plugin for Craft CMS
========================================

[](#tracker-integration-plugin-for-craft-cms)

[![Join the chat at https://gitter.im/flipboxfactory/craft-tracker](https://camo.githubusercontent.com/741e10d3a4bb638ca4d57d0a4bde72ee44aadf9cb3771b9a855bd8d8c337f246/68747470733a2f2f6261646765732e6769747465722e696d2f666c6970626f78666163746f72792f6f7267616e697a6174696f6e732e737667)](https://gitter.im/flipboxfactory/organizations?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Latest Version](https://camo.githubusercontent.com/0be34af8f25440ec2fbf69c8f108538857f8f6d455db3f7b92e461d791bc0265/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f666c6970626f78666163746f72792f63726166742d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://github.com/flipboxfactory/craft-tracker/releases)[![Software License](https://camo.githubusercontent.com/7bb09e7c53051d10bf37beea24a0396b80d87c85615a6c9db63a65f14c6cc977/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d50726f70726965746172792d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/85cc9d5bc7db014526ec5d0384e4d0eaf6d833cd40eb57f0cdec3e5ff5b337d3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f666c6970626f78666163746f72792f63726166742d747261636b65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/flipboxfactory/craft-tracker)[![Coverage Status](https://camo.githubusercontent.com/845a02879886c818a3f3b65afeab7c2b6d42b7e59cff618325d3d3ce70e29659/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f666c6970626f78666163746f72792f63726166742d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/flipboxfactory/craft-tracker/code-structure)[![Quality Score](https://camo.githubusercontent.com/b359ea097fdfb6940bdafef094944bfc28fddc53ba352c3c68765429a22cd721/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f666c6970626f78666163746f72792f63726166742d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/flipboxfactory/craft-tracker)[![Total Downloads](https://camo.githubusercontent.com/8801eb76ff17683b7916804c13ba9128fab804f38addf6e0bc60b4a5e953be06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c6970626f78666163746f72792f63726166742d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/flipboxfactory/craft-tracker)

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

[](#installation)

To install, use composer:

```
composer require flipboxfactory/craft-tracker

```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/flipboxfactory/craft-tracker/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Flipbox Digital](https://github.com/flipboxfactory)

License
-------

[](#license)

Please see [License File](https://github.com/flipboxfactory/craft-tracker/blob/master/LICENSE) for more information.

Examples
--------

[](#examples)

#### List Event Counts via RollUp object

[](#list-event-counts-via-rollup-object)

```

{% for rollUp in craft.tracker.rollUp.author(currentUser).all()
%}

        {{ rollUp.entry.title }}
        Hit Count: {{ rollUp.count }}

{% endfor %}

```

#### List All Events By Entry

[](#list-all-events-by-entry)

```
{% set entryId = 1 %}

{% for event in craft.tracker.query.entryId(entryId).all() %}

        {{ event.title }} -- {{ event.event }}
        User Agent: {{ event.userAgent }}
        IP: {{ event.remoteIp }}
        OS: {{ event.clientOs }}
        Created At: {{ event.dateCreated }}
        Metadata:

            {% for key, value in event.metadata|json_decode %}

                    {{ key }} - {{ value }}

            {% endfor %}

{% endfor %}

```

#### Record Event via TWIG Template

[](#record-event-via-twig-template)

```
{# Basic 'Page View' type tracking #}
{% do craft.tracker.track({entry: entry}) %}

{# Explicitly set track attributes #}
{% do craft.tracker.track({entry: entry, event: "Viewed::PDF"}) %}
```

#### Record Event (AJAX / JQuery)

[](#record-event-ajax--jquery)

```
{% set metadata = {foo: "bar"} %}

Goto Google

    $(function () {
        $('[data-event][data-entry-id]').click(function () {
            let data = $(this).data();
            data.{{ craft.app.config.general.csrfTokenName }} = "{{ craft.app.request.csrfToken }}"

            console.log("Begin track event", data);

            $.ajax({
                async: false,
                type: "POST",
                url: "{{ actionUrl('/tracker/track/event') }}",
                data: JSON.stringify(data),
                headers: {
                    Accept: "application/json; charset=utf-8",
                    "Content-Type": "application/json; charset=utf-8"
                },
                contentType: "application/json",
                dataType: "json",
                success: function (response) {
                    console.log("End track event", response);
                },
            });
        });
    });

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f88ef7075dc76a34393f80402c30cc8eec30d5134835314136669a68b8ce817f?d=identicon)[nateiler](/maintainers/nateiler)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/flipboxfactory-craft-tracker/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.4k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M273](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M337](/packages/open-telemetry-sdk)

PHPackages © 2026

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