Download the PHP package aleksa/laravel-visitors-statistics without Composer
On this page you can find all versions of the php package aleksa/laravel-visitors-statistics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aleksa/laravel-visitors-statistics
More information about aleksa/laravel-visitors-statistics
Files in aleksa/laravel-visitors-statistics
Package laravel-visitors-statistics
Short Description Simple visitor tracker and statistics package for Laravel 5 that can be used for dashboard graphs.
License MIT
Informations about the package laravel-visitors-statistics
Laravel Visitor Statistics
Simple visitor tracker and statistics package for Laravel 5 that can be used for dashboard graphs. Includes controller and routes to fetch visitor statistics (all and unique visits) for a certain month or year. You can also get total number of visits per country.
Installation
1) Install package using composer:
2) Since the package automatically adds it's middleware to web
group you will have to register service provider manually
3) Run migrations:
4) Publish configuration:
and choose Aleksa\LaravelVisitorsStatistics\Providers\VisitorStatisticsProvider
from the list
5) Download MaxMind database
GeoIP
Since fetching data from external API (eg: ipstack, ipdata etc...) takes time and slows down your application and can also produce monthly costs the package uses local MaxMind database and maxmind-db/reader
package for reading it's contents and locating the visitors.
For more sophisticated tracking you should use something like Google Analytics.
Configuration
Name | Description | Default |
---|---|---|
track_authenticated_users | Should the tracker track authenticated users | false |
track_ajax_request | Should the tracker track ajax requests | false |
login_route_path | Admin login path so that login attempts don't track as visits | 'admin' |
prefix | Prefix to apply to all statistics fetching routes | 'admin' |
middleware | Middlewares to be applied to all statistics fetching routes | '['web', 'auth']' |
database_location | Location where to store MaxMind database | storage_path('app/maxmind.mmdb') |
database_download_url | MaxMind database download url | MAXMIND_URL |
auto_update | Should laravel automatically update MaxMind database | true |
NOTE: If you set auto_update
to true make sure to add Laravel cron entry that is needed for Task Scheduling.
Fetching statistics
The package comes with a controller and a bunch of routes to fetch statistics. The idea is to fetch statistics on your dashboard with AJAX request and parse data to some JavaScript graph library like Highcharts.
Route name | Route URI | Description |
---|---|---|
visitorstatistics.all_statistics | /statistics/{year}/{month?} | Get statistics for the given year or month. |
visitorstatistics.unique_statistics | /statistics/unique/{year}/{month?} | Get unique statistics for the given year or month. |
visitorstatistics.total_statistics | /statistics/total/{year}/{month?} | Get both all and unique statistics for a given year or month. |
visitorstatistics.countries | /statistics/countries | Get visits count and percentage for each country. |
visitorstatistics.available_dates | /statistics/available/{year?} | Get years or months that have statistics tracked. |
NOTE: All routes are prefixed with value set in configuration and return response in JSON
format.
Example responses
/admin/statistics/2019
/admin/statistics/2019/6
/admin/statistics/total/2019
/admin/statistics/countries
/admin/statistics/available
Information being collected
This is the data that is being tracked for each visitor.
Name | Description |
---|---|
ip | e.g. '127.0.0.1' |
country | e.g. 'Serbia' |
city | e.g. 'Belgrade' |
device | e.g. 'desktop' |
browser | e.g. 'Chrome' |
License
This is open-sourced software licensed under the MIT license.
All versions of laravel-visitors-statistics with dependencies
ext-zlib Version *
illuminate/http Version ~7.0.0
illuminate/database Version ~7.0.0
illuminate/routing Version ~7.0.0
illuminate/support Version ~7.0.0
piwik/device-detector Version ^3.11
maxmind-db/reader Version ^1.4