Download the PHP package rainestech/tracker without Composer
On this page you can find all versions of the php package rainestech/tracker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rainestech/tracker
More information about rainestech/tracker
Files in rainestech/tracker
Informations about the package tracker
Laravel Stats Tracker
Tracker gathers a lot of information from your requests to identify and store:
- Sessions
- Page Views (hits on routes)
- Users (logged users)
- Devices (computer, smartphone, tablet...)
- Languages (preference, language range)
- User Devices (by, yeah, storing a cookie on each device)
- Browsers (Chrome, Mozilla Firefox, Safari, Internet Explorer...)
- Operating Systems (iOS, Mac OS, Linux, Windows...)
- Geo Location Data (Latitute, Longitude, Country and City)
- Routes and all its parameters
- Events
- Referers (url, medium, source, search term...)
- Exceptions/Errors
- Sql queries and all its bindings
- Url queries and all its arguments
- Database connections
Index
- Why?
- How To Use It
- Screenshots
- Blade Views
- Table Schemas
- System Requirements
- Installing
- Upgrading
- Changelog
- Contributing
Why?
Storing user tracking information, on indexed and normalized database tables, wastes less disk space and ease the extract of valuable information about your application and business.
Usage
As soon as you install and enable it, Tracker will start storing all information you tell it to, then you can in your application use the Tracker Facade to access everything. Here are some of the methods and relatioships available:
Current Session/Visitor
Most of those methods return an Eloquent model or collection, so you can use not only its attributes, but also relational data:
Sessions (visits)
Online Users
Brings all online sessions (logged and unlogged users)
Users
User Devices
Events
Errors
PageViews summary
PageViews By Country summary
Filter range
You can send timestamp ranges to those methods using the Minutes class:
Routes By Name
Having a route of
You can use this method to select all hits on that particular route and count them using Laravel:
And if you need count how many unique visitors accessed that route, you can do:
Screenshots
Visits
Charts
Users
Events
Errors
Blade Views
The views above are available in this package, but you need to install the sb-admin
panel on your public folder, please look at the instructions below.
How data is stored
All tables are prefixed by tracker_
, and here's an extract of some of them, showing columns and contents:
sessions
devices
agents
languages
domains
errors
events
geoip
log
paths
route_paths
routes
sql_queries ;
Manually log things
If your application has special needs, you can manually log things like:
Events
Routes
Requirements
- Laravel 4.1+ or 5+
- PHP 5.3.7+
- Package "geoip/geoip":"~1.14" or "geoip2/geoip2":"~2.0" (If you are planning to store Geo IP information)
Installing
Require the tracker
package by executing the following command in your command line:
composer require pragmarx/tracker
Add the service provider to your app/config/app.php:
'PragmaRX\Tracker\Vendor\Laravel\ServiceProvider',
Add the alias to the facade on your app/config/app.php:
'Tracker' => 'PragmaRX\Tracker\Vendor\Laravel\Facade',
Publish tracker configuration:
Laravel 4
php artisan config:publish pragmarx/tracker
Laravel 5
php artisan vendor:publish
Enable the Middleware (Laravel 5)
'use_middleware' => true,
Add the Middleware to Laravel Kernel (Laravel 5)
Open the file app/Http/Kernel.php
and add the following to your web middlewares:
\PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,
Enable Tracker in your config.php (Laravel 4) or tracker.php (Laravel 5)
'enabled' => true,
Publish the migration
php artisan tracker:tables
This is only needed if you are on Laravel 4, because vendor:publish
does it for you in Laravel 5.
Create a database connection for it on your config/database.php
'tracker' => [
'driver' => '...',
'host' => '...',
'database' => ...,
...
],
Migrate it
If you have set the default connection to tracker
, you can
php artisan migrate
Otherwise you'll have to
php artisan migrate --database=tracker
If you are planning to store Geo IP information, also install the geoip package:
composer require "geoip/geoip":"~1.14"
or
composer require "geoip2/geoip2":"~2.0"
And make sure you don't have the PHP module installed. This is a Debian/Ubuntu example:
sudo apt-get purge php5-geoip
Everything Is Disabled By Default
Tracker has a lot of logging options, but you need to decide what you want to log. Starting by enabling this one:
'log_enabled' => true,
It is responsible for logging page hits and sessions, basically the client IP address.
Multiple authentication drivers
You just have to all your auth IOC bidings to the array:
'authentication_ioc_binding' => ['auth', 'admin'],
Stats Panel
To use the stats panel on your website you'll need to download the sb-admin 2 sources to your public folder:
wget --output-document=/tmp/sba2.zip https://github.com/BlackrockDigital/startbootstrap-sb-admin-2/archive/v1.0.8.zip
unzip /tmp/sba2.zip -d /tmp
mkdir -p public/templates; mv /tmp/startbootstrap-sb-admin-2-1.0.8 public/templates/sb-admin-2
And enabled in your config file:
'stats_panel_enabled' => true,
Set the web middleware for stats routes (Laravel 5)
'stats_routes_middleware' => 'web',
Only admins can view the stats, so if you don't have an is_admin attribute on your user model, you'll have to add one:
public function getIsAdminAttribute()
{
return true;
}
It can be 'admin', 'is_admin', 'root' or 'is_root'.
Author
License
Tracker is licensed under the BSD 3-Clause License - see the LICENSE
file for details
Contributing
Pull requests and issues are more than welcome.
All versions of tracker with dependencies
laravel/framework Version ~4|~5
pragmarx/support Version ~0.6
ramsey/uuid Version ~3
jenssegers/agent Version ~2.1
ua-parser/uap-php Version ~3.4
snowplow/referer-parser Version ~0.1
jaybizzle/crawler-detect Version ~1.0