PHPackages                             asci/track - 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. asci/track

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

asci/track
==========

track is event based tracking system with multiple database backend support.

v1.0.1(12y ago)1024.6k5MITPHPPHP &gt;=5.3.3

Since Mar 23Pushed 11y ago2 watchersCompare

[ Source](https://github.com/ismailasci/track)[ Packagist](https://packagist.org/packages/asci/track)[ RSS](/packages/asci-track/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

track event based tracking system with multiple backend support
---------------------------------------------------------------

[](#track-event-based-tracking-system-with-multiple-backend-support)

[![Build Status](https://camo.githubusercontent.com/5de4b46cb6a3a70e6329f9bfe0ec721a965fb4bea19a39aca17c6c679c2ab832/68747470733a2f2f7472617669732d63692e6f72672f69736d61696c617363692f747261636b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ismailasci/track)[![Latest Stable Version](https://camo.githubusercontent.com/66c5ce267e9f4c0cdea0052341d6db51756cb2362dea806c02ff97e410624dc2/68747470733a2f2f706f7365722e707567782e6f72672f617363692f747261636b2f762f737461626c652e706e67)](https://packagist.org/packages/asci/track) [![Total Downloads](https://camo.githubusercontent.com/801e1e1d75c7cad3f25a02de68570df056d708bb69857d368bc2fb46c10d2688/68747470733a2f2f706f7365722e707567782e6f72672f617363692f747261636b2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/asci/track)[![SensioLabsInsight](https://camo.githubusercontent.com/5a1d4697d641a12bf29c37913616a77f26e55293ea6d69a0c3e7d8306477172f/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34663734383062302d353730352d343861342d613031392d6161643532326639376635382f6d696e692e706e67)](https://insight.sensiolabs.com/projects/4f7480b0-5705-48a4-a019-aad522f97f58)

track is an event based tracking system that helps you to collect and query statistical data based on the actions from your customers, users or visitors.

With track you can;

- collect page views, clicks, conversions or any kind of user actions for your website, API or mobile app.
- query collected data with complex filters. (currently only with native queries)
- create funnels (in progress)

### Features

[](#features)

- Collect data with unlimited custom parameters.

```
new Event(
    'Purchase',
    array(
        'Affiliate'     => 'Amazon.de',
        'Category'      => 'Smartphones',
        'Product Name'  => 'iPhone 5s Black 64GB',
        'Price'         => 549.99,
        //...
    )
);
```

- Query on collected data and create analytics.
- Create funnels (in progress)
- Duplicate/Unique filtering. (in progress)
- Multiple database backend options. (currently only mongodb and postgresql with hstore)
- Easily extendable architecture.
- Full test coverage with [phpspec](http://phpspec.net/).

### Events

[](#events)

An `event` basically defines the same thing as in its name. Any kind of action made by your customers, users or applications can be described as an event. For instance; 'Page View', 'Button Click', 'Purchase', 'API Request', 'Exception', etc.

Track defines events within the special `Event` objects. An `Event` object can carry many special information with it among the custom ones. For instance an Event object can have;

- IP address,
- a unique key to distinguish your users,
- the time of the event,
- requested URL,
- product category,
- pruduct name,
- customer source,
- and many other defined by you.

Track comes with bunch of built-in events specicialized for different purposes. All the built-in event can be found under the `Track\Event` namespace. You can also define your own customized events for your needs.

### Built-in Events

[](#built-in-events)

Track comes with bunch of built-in events specicialized for different purposes. All the built-in event can be found under the `Track\Event` namespace.

#### 1. Track\\Event

[](#1-trackevent)

This is the base event of Track and provides very basic expectations from an event. All the other events has to be extending to it, this means that every event has to/will have at least a `name`, a `timestamp` and a unique `id`. If you don't give these values while initializing your event object they will get automatically generated by Track.

```
$event = new Track\Event(
    'Page View',                // Event name
    array(
        'utm_source' => 'partner_x',
        'utml_medium' => 'affiliate',
    )
);

print_r($event->toArray());

/*
will give you like the following

array(
    'timestamp' => 'timestamp',
    'id' => 'random_string',
    'utm_source' => 'partner_x',
    'utml_medium' => 'affiliate'
)
*/
```

### Examples

[](#examples)

**Store an event**

```
use Track\Client;
use Track\Storage\MongoDBStorage;
use Track\Event\Event;

// Configure your mongodb connection
$mongoClient = new \MongoClient();
$mongoDB = $mongoClient->selectDB('stats');

// Initialize the storage
$storage = new MongoDBStorage($mongoDB);

$client = new Client($storage);

// Create an event for your needs
$event = new Event(
    'Purchase',
    array(
        'Affiliate' => 'Amazon.de',
        'Category'  => 'Smartphones',
        'Product Name'  => 'iPhone 5s Black',
        'Price' => 549.99,
    )
);

// Store the event
$client->track($event);
```

**Query events**

```
use Track\Query;
use Track\Storage\MongoDBStorage;

// Configure your mongodb connection
$mongoClient = new \MongoClient();
$mongoDB = $mongoClient->selectDB('stats');

// Initialize the storage
$storage = new MongoDBStorage($mongoDB);

$query = new Query($storage);
$results = $query->native(array('name' => 'Purchase'));

/*
will return

array(
    array(
        'Affiliate' => 'Amazon.de',
        'Category'  => 'Smartphones',
        'Product Name'  => 'iPhone 5s Black',
        'Price' => 549.99,
        ...
    ),
    ...
)
*/
```

#### PostgreSQL hstore Setup

[](#postgresql-hstore-setup)

```
CREATE EXTENSION IF NOT EXISTS hstore;

CREATE TABLE IF NOT EXISTS events (
  id serial PRIMARY KEY,
  data hstore
);

-- Some hstore raw query examples

SELECT data
FROM events
WHERE (data->'timestamp')::int > 12345678;

SELECT data
FROM events
WHERE data->'name'= 'Purchase';
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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 ~1 days

Total

2

Last Release

4434d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1300970?v=4)[Ismail Asci](/maintainers/ismailasci)[@ismailasci](https://github.com/ismailasci)

---

Top Contributors

[![iasci](https://avatars.githubusercontent.com/u/5040414?v=4)](https://github.com/iasci "iasci (9 commits)")[![bamarni](https://avatars.githubusercontent.com/u/1205386?v=4)](https://github.com/bamarni "bamarni (1 commits)")

---

Tags

eventtrackingconversionmarketingstatistic

### Embed Badge

![Health badge](/badges/asci-track/health.svg)

```
[![Health](https://phpackages.com/badges/asci-track/health.svg)](https://phpackages.com/packages/asci-track)
```

###  Alternatives

[doctrine/event-manager

The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.

6.1k501.1M115](/packages/doctrine-event-manager)[league/event

Event package

1.6k141.6M184](/packages/league-event)[laminas/laminas-eventmanager

Trigger and listen to events within a PHP application

1.0k69.8M225](/packages/laminas-laminas-eventmanager)[cuyz/valinor

Dependency free PHP library that helps to map any input into a strongly-typed structure.

1.5k9.2M108](/packages/cuyz-valinor)[florianv/swap

Exchange rates library for PHP

1.3k6.4M16](/packages/florianv-swap)[spatie/laravel-event-sourcing

The easiest way to get started with event sourcing in Laravel

9003.7M26](/packages/spatie-laravel-event-sourcing)

PHPackages © 2026

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