/laravel-analytics

Analytics for the Laravel framework.

Primary LanguagePHPMIT LicenseMIT

Laravel Analytics

Latest Stable Version

Easily collect page view analytics with a beautifully simple to use dashboard.

Laravel Analytics Dashboard

Installation

Install the package:

composer require andreaselia/analytics

Publish the config file and assets:

php artisan vendor:publish --provider="AndreasElia\Analytics\AnalyticsServiceProvider"

Don't forget to run the migrations:

php artisan migrate

You can add the page view middleware to a specific route group, e.g. web.php like so:

Route::middleware('analytics')->group(function () {
    // ...
});

Or add the page view to all middlewares/on an application level like so:

// app/Http/Kernel.php

protected $middleware = [
    // ...
    \AndreasElia\Analytics\Http\Middleware\Analytics::class,
];

Contributing

You're more than welcome to submit a pull request, or if you're not feeling up to it - create an issue so someone else can pick it up.