- How do I install laravel-page-visits in a Laravel app?
- Install it with Composer using composer require jeffersongoncalves/laravel-page-visits, then publish the package migrations with php artisan vendor:publish --tag="page-visits-migrations" and run php artisan migrate. After that, schedule the page-visits:aggregate-and-prune command so visits are rolled up into daily stats. No external service or queue worker is required.
- Which Laravel and PHP versions does laravel-page-visits support?
- The package is a standard Laravel package with a service provider, publishable migrations, and an Artisan command, so it fits normal Laravel app conventions. The repository's composer.json is the authoritative source for the exact Laravel and PHP version constraints; check it before adding the package to an older application.
- Does laravel-page-visits need Google Analytics or another external service?
- No. laravel-page-visits records visits directly in your application's database and aggregates them into a local daily-stats table, so you are not sending page-view data to Google Analytics or another third-party analytics service. You remain responsible for your own retention, pruning, and reporting.
- What visitor data does laravel-page-visits record?
- It captures page-view visits on public routes along with device, browser, geo, locale, referer, and UTM parameters. That makes it useful for understanding traffic patterns, popular content, and campaign attribution without an external analytics script.
- How does laravel-page-visits store and aggregate page visits?
- Visits are stored in your application database through the package migrations, and an Artisan command aggregates them into the dedicated page_visit_daily_stats table. The daily table is what you query for traffic reporting, and in 1.3.0 it also carries response_time_stats with count, average, minimum, maximum, p50, p95, and p99 values in milliseconds.
- How do I schedule the page-visits:aggregate-and-prune command?
- Add the command to your Laravel scheduler, for example Schedule::command('page-visits:aggregate-and-prune')->daily(), so aggregation and retention pruning run automatically. Confirm the default retention window and run the command manually in staging first so you understand what it prunes before enabling it in production.
- What database is required for response time percentiles in laravel-page-visits 1.3.0?
- The 1.3.0 response_time_stats percentiles are computed with SQL aggregates, which generally requires MySQL 8+, PostgreSQL, or an equivalent engine with window functions or ordered-set aggregates. MariaDB and older MySQL 5.7 deployments may fail or silently degrade, so verify your engine version before relying on p50/p95/p99 in production. The upgrade migration itself only adds a nullable column, but the percentile feature is database-capability dependent.
- Why are response_time_stats values null for older dates?
- Existing daily-stat rows are not backfilled when you upgrade, so dates before 1.3.0 will have null response_time_stats. Days with no timed visits can also produce null stats. Reporting and alerting must treat null as no data rather than zero before you publish any SLO.
- Does laravel-page-visits measure server-side response time or browser RUM timing?
- The response_time_stats column records request response-time percentiles in milliseconds, which is intended as server-side request duration rather than browser-based real-user monitoring. Confirm which routes are instrumented and whether health checks, admin routes, or API paths are excluded, because those choices affect whether the numbers are dashboard-grade or SLO-grade.
- How do I upgrade laravel-page-visits from 1.2.x to 1.3.0?
- Upgrading is additive: publish the migrations tag again, inspect the generated migration, and run php artisan migrate to add the nullable response_time_stats column. No application code changes are required, and rolling back to 1.2.x is safe because older code simply ignores the new column. Apply the migration in a low-traffic window and test it against a production-sized staging copy.