Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Analytics Laravel Package

andreaselia/analytics

andreaselia/analytics is a lightweight, privacy-friendly analytics package for Laravel. It tracks page views, unique visitors, referrers, browsers, devices, and countries in your own database, with a built-in dashboard for quick insights and no external service required.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • Laravel-native package shape: service provider, publishable config + migrations, Eloquent models, and a tracking middleware. This is the lowest-friction integration pattern in the Laravel ecosystem — no sidecar, no external SaaS, no JS tag.
  • Fits a "first-party, server-side, single-tenant" analytics need: page views, sessions, referrers, device/browser, optionally geo. It is not an event-level product analytics tool (no custom events, no funnels/cohorts out of the box, no built-in dashboard UI in the common distribution).
  • Server-side capture is architecturally aligned with privacy-sensitive or consent-averse contexts, but it is structurally blind to client-only navigation (Inertia/SPA route changes without full page loads), client-side interactions, and any request served from a CDN or full-page cache.

Integration feasibility

  • Effort is small: composer require, publish config/migrations, register middleware (global or route group), migrate, optionally schedule pruning. A single developer can produce a working spike in under a day.
  • Main feasibility unknowns are not install effort but accuracy semantics: what constitutes a session, how bots are filtered, whether writes are synchronous, and how geo enrichment is sourced. These determine whether the data is trustworthy enough to make roadmap decisions on.

Technical risk

  • Adoption risk (high): 198 stars and 0 dependents means essentially no ecosystem validation. There is no evidence of production use at scale, and no downstream projects to inherit bug fixes from.
  • Bus factor (high): single-maintainer package. Combined with an anomalous last-release date (2026-10-20, i.e., future-dated in the supplied metadata), release cadence and metadata integrity should be verified directly against the repo and Packagist before any commitment.
  • Data quality risk (medium): server-side tracking systematically undercounts cached/edge-served pages, overcounts bots and prefetches unless filtering is tuned, and mis-attributes traffic behind unconfigured proxies/load balancers.
  • Privacy/compliance risk (medium): IP, user agent, and geo are personal data under GDPR/CCPA. Server-side capture reduces cookie-consent surface but does not eliminate it; retention limits and lawful basis still need decisions.
  • Performance risk (medium): per-request database writes to the primary application DB create write amplification on high-traffic routes.

Key questions

  1. Does it track Inertia/Livewire/SPA navigations, or only full document requests?
  2. Are writes synchronous in the request lifecycle, and are they failure-isolated (never break page render)?
  3. What is the retention/pruning story — is there a command, or must we build it?
  4. Which geo provider and data source does it use, and what is the lookup cost/failure behavior?
  5. What is the supported Laravel/PHP version matrix, and is there meaningful test coverage and CI?
  6. Does it honor DNT/consent signals and support excluding authenticated users or internal IPs?
  7. Is the data model tenant-aware, or will multi-tenancy require forking?
  8. Is there any reporting UI, or do we own 100% of the presentation layer?

Integration Approach

Stack fit

  • Assumes a conventional Laravel app (PHP 8.x, Laravel 9–12 — confirm on the version matrix) using MySQL/Postgres/SQLite via Eloquent. No Redis, ClickHouse, or columnar store dependency, which is good for fit and bad for scale.
  • Works best when the app already owns a scheduler (for pruning/rollups) and a queue (to move writes off the request path).

Migration path

  • Purely additive: new prefixed tables, no changes to existing schema. Low rollback cost — remove middleware, drop tables.
  • No backfill is possible; data only accrues from activation. If replacing GA/Plausible/Matomo, plan a parallel-run window (2–4 weeks) and compare page-view and session counts before decommissioning anything.
  • Sequence:
    1. Spike on a branch; publish config/migrations; enable on staging only.
    2. Benchmark request latency and DB write volume under production-like traffic.
    3. Harden config: ignore paths (health checks, admin, API, assets), bot/robot filtering, authenticated-user policy, trusted proxies.
    4. Decide write path: synchronous vs. queued/aggregated. Default to queueing if p95 latency moves at all.
    5. Ship retention + rollup jobs before go-live, not after.
    6. Build the reporting surface (Blade/Livewire dashboard or BI tool on the tables).
    7. Roll out behind a config flag, gradually by route group.

Compatibility

  • Middleware ordering matters: must run after session/auth start to attribute users, and must not interfere with response caching or ETag handling.
  • Response caching/CDN: tracked routes must bypass full-page cache, or tracking becomes a sample of cache misses rather than of traffic. Decide explicitly which routes are in scope.
  • Octane: verify no long-lived static state or config-capture issues across requests.
  • Multi-tenant/Livewire: assume custom work for tenant scoping and component-level navigation.

Sequencing recommendation Treat this as a product-analytics-lite decision, not a GA replacement. If the requirement is "traffic trends, top pages, referrers, device mix for an internal audience," it is a credible low-cost fit. If the requirement is experimentation, attribution, or revenue analytics, sequence this as a complement and keep a mature tool for the analytical layer.

Operational Impact

Maintenance

  • Small code footprint keeps maintenance cheap, but the single-maintainer profile means we should plan to vendor/fork: pin an exact version, mirror the repo internally, and budget a few days per year for patch-and-diff. Do not rely on upstream for security turnaround.
  • Schema changes ship with the package; every major bump is a migration event requiring a staging rehearsal.

Support

  • Community-only support (issues/PRs), no SLA, no vendor. Internal ownership must be explicit — a named engineer accountable for upgrades, filtering tuning, and data quality — otherwise the tables silently rot.
  • Document the data model semantics internally (what counts as a session, bot policy, timezone handling); otherwise PMs and analysts will misread metrics and trust will erode.

Scaling

  • Cost scales linearly with request volume: one session upsert plus one page-view insert per tracked request against the application's primary database. This is fine at low-to-moderate RPS and becomes the dominant concern past a few hundred RPS.
  • Mitigations in order of preference: dedicated DB connection/replica, queued writes with batched inserts, route-level sampling, nightly rollup tables + aggressive pruning, and — if volume is genuinely large — replace the storage layer with Plausible/Umami/Matomo rather than engineering around it.
  • Reporting queries need composite indexes (date, path, session) and date-bounded access; unbounded dashboard queries will be the first production incident.

Failure modes

  • Render-path failure: if the tracking write is not exception-isolated, a DB hiccup takes down the site. Verify and wrap.
  • Data inflation: bot/prefetch floods inflate page views and bloat tables; requires filtering plus rate awareness.
  • Silent undercount: CDN/response cache serving pages means missing rows, with no signal that data is incomplete — the most dangerous failure because it is invisible.
  • Geo lookup degradation: external provider latency or quota exhaustion adds tail latency or drops enrichment.
  • Attribution errors: unconfigured trusted proxies collapse all traffic onto a load-balancer IP; session stitching breaks for cookieless clients.
  • Table growth: without a retention job, tables grow without bound and degrade both app writes and dashboard queries.

Ramp-up

  • Engineering: ~0.5–1 day to integrate, ~2–3 days to harden (filtering, queueing, retention, dashboard).
  • Analytics/PM consumers: ~1 day of documentation and calibration against a known-good source before the numbers are used in decisions.
  • Overall: a 1–2 week scoped initiative for a small team, with the caveat that the reporting layer — not the package — is the bulk of the work.

TPM verdict: Low-cost, architecturally clean, privacy-friendly fit for internal traffic analytics in a standard Laravel app, contingent on validating maintenance health and Laravel-version support. Do not position it as a GA replacement or as the system of record for product decisions; gate adoption on a parallel-run accuracy check, a queue-backed write path, and a named internal owner.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle