ssebetta/larnalytics

A simple web analytics tool for laravel projects

Installs: 35

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Language:Blade

Type:package

pkg:composer/ssebetta/larnalytics

1.0.6 2024-07-12 20:28 UTC

This package is auto-updated.

Last update: 2025-12-12 23:37:55 UTC


README

Larnalytics is a simple site analytics package for Laravel applications.

Installation

  1. Require the package using Composer:

    composer require ssebetta/larnalytics
  2. Publish the package's configuration and migration files:

    php artisan vendor:publish --provider="Ssebetta\Larnalytics\Providers\LarnalyticsServiceProvider"
  3. Run the migrations to create the necessary database tables:

    php artisan migrate
  4. Register the middleware in your app/Http/Kernel.php file:

    protected $middlewareGroups = [
        'web' => [
            // ...
            \Ssebetta\Larnalytics\Http\Middleware\TrackPageViews::class,
        ],
    ];

Extra

Run php artisan route:cache to access the analytics/page-views route

Usage

Larnalytics will automatically track page views and store the data in the page_views table.

Use your-site-url/analytics/page-views to access the frontend view.

You can log custom events using the Analytics helper:

use Ssebetta\Larnalytics\Helpers\Analytics;

Analytics::logEvent('event_name', ['key' => 'value']);