PHPackages                             voerro/laravel-visitor-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. voerro/laravel-visitor-tracker

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

voerro/laravel-visitor-tracker
==============================

Visitor tracker and statistics for Laravel 5

v1.2.2(7y ago)6716.5k↓50%41[6 issues](https://github.com/voerro/laravel-visitor-tracker/issues)[1 PRs](https://github.com/voerro/laravel-visitor-tracker/pulls)MITPHPPHP &gt;=7.0

Since Jan 2Pushed 7y ago5 watchersCompare

[ Source](https://github.com/voerro/laravel-visitor-tracker)[ Packagist](https://packagist.org/packages/voerro/laravel-visitor-tracker)[ RSS](/packages/voerro-laravel-visitor-tracker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (18)Used By (0)

Laravel Visitor Tracker and Statistics
======================================

[](#laravel-visitor-tracker-and-statistics)

[![Packagist](https://camo.githubusercontent.com/e25651668dd4ff5abec01f53ae856a86c5a3dc63f21ae8c920b7ab51ec3e3489/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f6572726f2f6c61726176656c2d76697369746f722d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/voerro/laravel-visitor-tracker) [![Packagist](https://camo.githubusercontent.com/bcf05fd27f29c64c0279526920ac267e8e45c654d3073fef8dac8e4ad37aedac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f766f6572726f2f6c61726176656c2d76697369746f722d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/voerro/laravel-visitor-tracker) [![Build Status](https://camo.githubusercontent.com/aa9469db4eaa31b68ee97561ba8396f17d07065b08a7cc9215e9844c8b2fabeb/68747470733a2f2f7472617669732d63692e6f72672f766f6572726f2f6c61726176656c2d76697369746f722d747261636b65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/voerro/laravel-visitor-tracker) [![StyleCI](https://camo.githubusercontent.com/fe63f8f901e5843422ce17418c4198ada4649dc8bd1896410b562839cde92811/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131363031313834392f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/116011849) [![Packagist](https://camo.githubusercontent.com/e43746f8414ccaac392f0ae4343d0c0c65ae39e6a99fef9f6ea1295417056d10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f766f6572726f2f6c61726176656c2d76697369746f722d747261636b65722e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)

Track your authenticated and unauthenticated visitors, login attempts, ajax requests, and more. Includes a controller and a bunch of routes and views to display the statistics, as well as a helper class to fetch the statistics easily (in case you want to display the statistics yourself).

[Live Demo](http://statistics.voerro.com)

Installation - Basic
--------------------

[](#installation---basic)

1. Install the package using composer:

```
composer require voerro/laravel-visitor-tracker
```

2. Run the migration to install the package's table to record visits to by executing:

```
php artisan migrate
```

3. Add the middleware to `app/Http/Kernel.php`:

```
protected $middlewareGroups = [
    ...
    'web' => [
        ...
        \Voerro\Laravel\VisitorTracker\Middleware\RecordVisits::class,
    ],
    ...
];
```

4. Laravel 5.5 has package auto-discovery. If you have an older version, register the service provider in `config/app.php`:

```
...
'providers' => [
    ...
    Voerro\Laravel\VisitorTracker\VisitorTrackerServiceProvider::class,
    ...
],
...
```

If you want to fetch and display the visitor statistics yourself register the facade in the same file:

```
...
'aliases' => [
    ...
    'VisitStats' => Voerro\Laravel\VisitorTracker\Facades\VisitStats::class,
    ...
],
...
```

5. Publish the config file, assets, and views by running:

```
php artisan vendor:publish
```

Choose `Voerro\Laravel\VisitorTracker\VisitorTrackerServiceProvider` in the provided list.

Installation - Geoapi
---------------------

[](#installation---geoapi)

The tracker uses external API to fetch the geolocation data. To turn geoapi off set the `geoip_on` setting in the config file to false. To change a provider change the `geoip_driver` field. The supported drivers are listed in the configuration file. You might need to fill out additional API keys depending on the driver you choose.

Since fetching data from an external API takes time, the operation is queued an performed asynchronously. This is done using Laravel Jobs and probably won't work on a shared hosting. There are multiple drivers supported. We'll describe how to set up the database driver.

First, in your `.env` file you need to set:

```
QUEUE_DRIVER=database
```

Then run these commands one after another:

```
php artisan queue:table
php artisan queue:failed-table
php artisan migrate
```

Finally, you need to start the worker that will take care of the queue. Run the following command and keep it running:

```
php artisan queue:work
```

Read more on Queues and Jobs in the [Laravel documentation](https://laravel.com/docs/5.5/queues). [This section](https://laravel.com/docs/5.5/queues#supervisor-configuration) describes how to restart the queue worker automatically in case the process fails.

P.S. You need to restart the worker every time you've made changes to the package's config file.

Configuration
-------------

[](#configuration)

Check out the `config/visitortracker.php` file. It is well commented and additional explanations are not required. You can exclude certain user groups, individual users, and certain requests from being tracked there among other things.

Testing
-------

[](#testing)

The external API calls to retrieve geolocation information are disabled in the testing environment. Otherwise your tests would run really slow, since the tracker tracks all the requests.

Displaying Statistics
---------------------

[](#displaying-statistics)

The package comes with a controller and a bunch of routes and views to display statistics. You can fetch and display the stats yourself using the `VisitStats` class, but we'll talk about it later. The provided views are uncomplicated and styled with the standard Bootstrap classes.

To install the in-built routes add this line to your `routes.php` file:

```
VisitStats::routes();
```

You can put this line inside a group to restrict the access with middlewares and/or to add a prefix to the routes. For example, like this:

```
Route::middleware('auth')->prefix('admin')->group(function () {
    VisitStats::routes();
});
```

You can integrate the views into your existing layouts. Take a look at the `Views` section of the config file. All the routes are named so you could easily add and style links to all the pages. Below is the complete list of routes.

Route nameDescriptionvisitortracker.summaryA small summary pagevisitortracker.all\_requestsA list of all the requestsvisitortracker.visitsA list of page visits (same as all request minus ajax calls, bot visits, and login attempts)visitortracker.ajax\_requestsA list of AJAX requestsvisitortracker.botsA list of visits from bots/crawlersvisitortracker.login\_attemptsA list of login attempts (check the "Tracking login attempts" section of the config file)visitortracker.countriesA list of countries with the number of visits and unique visitors in each ordered by the date of last visitvisitortracker.osA list of operating systems with the number of visits and unique visitors from each ordered by the date of last visitvisitortracker.browsersA list of browsers with the number of visits and unique visitors from each ordered by the date of last visitvisitortracker.languagesA list of browser languages with the number of visits and unique visitors in each ordered by the date of last visitvisitortracker.uniqueA list of unique visitors (unique IPs) ordered by the date of last visitvisitortracker.usersA list of registered users with the total number of visits ordered by the date of last visitvisitortracker.urlsA list of URLs with the total number of visits and unique visitors ordered by the date of last visitWhat Information is Being Collected
-----------------------------------

[](#what-information-is-being-collected)

This is the data that is being collected by the tracker.

Database fieldDescriptionuser\_idAn id of an authenticated user performing the requestipe.g. '127.0.0.1'methode.g. 'GET'is\_ajaxWhether the request is an AJAX requesturle.g. ''referere.g. ''user\_agente.g. 'Mozilla/5.0 (X11; Ubuntu; Linux x86\_64; rv:58.0) Gecko/20100101 Firefox/58.0'is\_desktopWhether the request is made from a desktopis\_mobileWhether the request is made from a mobile deviceis\_botWhether the visitor is a bot/crawlerbote.g. 'Googlebot'os\_familye.g. 'linux'ose.g. 'Ubuntu'browser\_familye.g. 'firefox'browsere.g. 'Firefox 58.0'is\_login\_attemptWhether the request is a login attemptcountrye.g. 'Russia'country\_codee.g. 'RU'citye.g. 'Moscow'latLatitudelongLongitudebrowser\_language\_familye.g. 'en'browser\_languagee.g. 'en-US'created\_atA standard Laravel field which is also used as a visit/request datetimeThe package uses `piwik/device-detector` to parse the user agent.

Manually Fetching and Displaying Statistics
-------------------------------------------

[](#manually-fetching-and-displaying-statistics)

In case you are not content with the provided views, you can use the `Voerro\Laravel\VisitorTracker\Facades\VisitStats` class to fetch the statistics data and then make your own controller and views to display this data.

Take a look at the controller located at `src/Controllers/StatisticsController.php` to understand how to work with the class, it's pretty simple. The original class is located at `src/VisitStats.php` and all the methods inside are documented, in case you need more insights.

License
-------

[](#license)

This is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 98.8% 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 ~20 days

Recently: every ~56 days

Total

17

Last Release

2729d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9262f3a0b6d6f98f4be06bec28d16f70290a1a7a5d05d07ffa5c5432a4521c17?d=identicon)[AlexMordred](/maintainers/AlexMordred)

---

Top Contributors

[![AlexMordred](https://avatars.githubusercontent.com/u/8043551?v=4)](https://github.com/AlexMordred "AlexMordred (81 commits)")[![mohamedsabil83](https://avatars.githubusercontent.com/u/10126040?v=4)](https://github.com/mohamedsabil83 "mohamedsabil83 (1 commits)")

---

Tags

laravelvisitor-tracker

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/voerro-laravel-visitor-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/voerro-laravel-visitor-tracker/health.svg)](https://phpackages.com/packages/voerro-laravel-visitor-tracker)
```

###  Alternatives

[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k49.4M479](/packages/laravel-scout)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)

PHPackages © 2026

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