PHPackages                             shamaseen/laravel-analytics - 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. shamaseen/laravel-analytics

ActiveLibrary

shamaseen/laravel-analytics
===========================

Get your website traffic/conversion analytics natively from Laravel WITHOUT using Google analytic or any third party.

101PHP

Since Sep 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mshamaseen/laravel-analytics)[ Packagist](https://packagist.org/packages/shamaseen/laravel-analytics)[ RSS](/packages/shamaseen-laravel-analytics/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel analytics is an analytic tool to track conversions, weather you want to track visitors of your website or other conversions such us registration, subscription, or any type of action, then Laravel analytics is what you are looking for.

Laravel analytics will also record the user\\guest device information, such as the device type, os, browser, version, language, city, country, continent, timezone for statistics.

NOTE: this package does NOT use Google Analytics, if you want Google analytics use [spatie/laravel-analytics](https://github.com/spatie/laravel-analytics) package instead.

installation
------------

[](#installation)

Run

`composer install shamaseen/laravel-analytics`

Publish the config file by running

`php artisan vendor:publish --provider="Shamaseen\Analytics\ServiceProvider"`

and at last run

`php artisan migrate`

to run the migration files.

ℹ️ the migration will add two tables to your database, la\_conversions and la\_device\_info
Usage
-----

[](#usage)

### Create

[](#create)

Create conversion:

```
Shamaseen\Analytics\Models\LaConversion::conversion($name,$weight = 100,$source = null, $force = false );

```

ℹ️ By default the package will check for conversions made with the same name within a threshold time defined in the config, if one found then the package will NOT insert the conversion to the database, to force insertion you should add send the force parameter as true
To create conversion for a model, use `Shamaseen\Analytics\Traits\Conversionable` as a trait in the model you want, then:

```
 yourModelInstance->la_conversions()->create([
        'name' => 'String: Required field',
        'weight' => 'Int: Optional field',
        'source' => 'String: Optional field',
        'force' => 'Boolean: Optional field, set this to true to force the insertion ',
    ])
```

### Statistics

[](#statistics)

To get statistics about the conversions create an instance of the Statistics class

```
$statistics = new \Shamaseen\Analytics\Repositories\Statistics($name, $start_at = null, $end_at = null)
```

or from yourModelInstance, like

```
 yourModelInstance->la_statistics($name,$start_at = null, $end_at = null)
```

ℹ️ If you call the statistics from your model then all the returned statistics will be the ones related to that model only.
By default, all method will return data about the current month only, if you want to adjust the date, set the start at and the end at when instancing the Statistics class.

Now you can run methods like:

```
    $statistics->sourcesCount()
```

```
    $statistics->citiesCount()
```

```
    $statistics->countriesCount()
```

```
    $statistics->continentCount()
```

```
    $statistics->timezoneCount()
```

```
    $statistics->conversionsOverTime()
```

### Extending the methods

[](#extending-the-methods)

You can always run your custom queries like you always do using the `LaConversion` model, but remember, this is an open source project, so new methods to the statistics class is always welcomed to be added, just make a request :).

### Statistics Data type

[](#statistics-data-type)

By default, statistics methods will return Laravel Collections, if you want to return arrays instead call:

```
$statistics->setResponse(\Shamaseen\Analytics\Repositories\Statistics::$ARRAY_RESPONSE)
```

License
-------

[](#license)

This project is an open source project licensed under **MIT**.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity28

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://avatars.githubusercontent.com/u/94133296?v=4)[Hamza Shamaseen](/maintainers/shamaseen)[@shamaseen](https://github.com/shamaseen)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/shamaseen-laravel-analytics/health.svg)

```
[![Health](https://phpackages.com/badges/shamaseen-laravel-analytics/health.svg)](https://phpackages.com/packages/shamaseen-laravel-analytics)
```

PHPackages © 2026

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