Search by

fomvasss / laravel-visits

fomvasss

Self-hosted, first-party analytics platform for Laravel: visitor/session/event tracking, geo/device/bot detection, campaign attribution, custom conversions tied to your own Eloquent models, rollup analytics, dashboard

Package info

github.com/fomvasss/laravel-visits

pkg:composer/fomvasss/laravel-visits

Statistics

Installs: 161

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

0.13.9 2026-10-07 16:53 UTC

README

License Latest Stable Version Total Downloads

Self-hosted, first-party analytics for Laravel: visitor, session and page-view tracking, geo/device/bot detection, campaign attribution, conversions tied to your own Eloquent models, daily rollups and a built-in dashboard with a live activity map — all in your own database.

Українською

Dashboard

  • Visitor → Session → Event — durable identity, browsing sessions, page views and custom actions instead of one flat table
  • Async-first — the request only resolves the visitor id; geo, device detection and writes run in a queued job
  • Three entry points — automatic page views (middleware), a JSON endpoint for the JS beacon and mobile apps, Visits::track() from PHP
  • Identity — cookie, client-supplied X-Visitor-Id, reconnection of logged-in users on Bearer-token APIs, merge on login or Visits::identify()
  • Attribution — UTM/ref first touch and last touch, ad click IDs, search keywords
  • Conversions on your models — Visits::track('order.placed', $order) and read it back from $order
  • Dashboard — Overview with a session map, Campaigns, Sessions, Visitors, Live map, Whoami
  • Events for every visit, conversion, new visitor, new session and identified user

Requirements

  • PHP ^8.3
  • Laravel ^12 | ^13
  • A queue worker and the scheduler

Installation

composer require fomvasss/laravel-visits
php artisan migrate

php artisan vendor:publish --tag=visits-config # optional
php artisan vendor:publish --tag=visits-assets # optional, JS beacon

Security: the dashboard at /visits is open to anyone by default. Set dashboard.middleware to e.g. ['web', 'auth'] before deploying.

Quick start

Every GET request through the web middleware group is now tracked; the dashboard is at /visits.

use Fomvasss\Visits\Concerns\HasVisits;

class Order extends Model
{
    use HasVisits;
}
use Fomvasss\Visits\Facades\Visits;

Visits::track('order.placed', $order, ['amount' => $order->total]);

// payment webhook: no cookie, take the visitor from the earlier event
Visits::track('order.paid', $order, inheritFrom: 'order.placed');

$order->latestVisitEvent('order.placed')->first()?->session->utm_source;
<script src="/vendor/visits/visits.js"></script>
<script>
    Visits.track('newsletter.subscribed', { plan: 'pro' });
</script>

Documentation

Online: https://fomvasss.github.io/laravel-visits/ — the same pages as in docs/.

Testing

composer test

License

MIT — see LICENSE.

Support

If this package is useful to you, consider supporting its development:

Monobank Ko-Fi USDT TRC20

USDT TRC20: THLgp6DxiAtbNHvgnKV56vk1L38UuUagKf