Download the PHP package ibrahim-kaya/visit-tracker without Composer
On this page you can find all versions of the php package ibrahim-kaya/visit-tracker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ibrahim-kaya/visit-tracker
More information about ibrahim-kaya/visit-tracker
Files in ibrahim-kaya/visit-tracker
Package visit-tracker
Short Description A Laravel package to track page visits including IP, browser, device, and referrer information.
License MIT
Informations about the package visit-tracker
Laravel Visit Tracker by İbrahim Kaya
A Laravel package to automatically track page visits including IP, browser, device, referrer, and more. Perfect for analytics and monitoring.
🌟 Features
- Automatic tracking of all web requests.
- Queue-based processing for better performance.
- Logs detailed visitor information:
- IP address (with optional geolocation from http://ip-api.com)
- Browser name
- Platform/OS
- Device type
- Referrer URL
- Full URL
- User agent
- HTTP method (GET, POST, PUT, DELETE, etc.)
- Request payload/body (optional, configurable with sensitive data exclusion)
- Authenticated user ID (if logged in)
- Attribute anonymous visits after login/register (visitor cookie + session)
- Exclude specific routes or paths.
- Exclude specific HTTP methods (e.g., POST, PATCH).
- Optional logging of bots.
- Configurable IP info cache duration.
- Middleware auto-registered for all web routes.
- Asynchronous IP geolocation processing via Laravel queues.
🚀 Installation
1️⃣ Require the package via Composer
2️⃣ Publish the configuration
- Creates
config/visit-tracker.php.
3️⃣ Run migrations
- Creates
page_visit_logstable.
4️⃣ Configure queue system (optional)
If you want to use queues (recommended for production), make sure your Laravel application has a queue driver configured in .env:
If using database queues, run:
If you don't want to use queues, set use_queue => false in config/visit-tracker.php. This will process visits synchronously (useful for development/testing).
Start queue worker (only if using queues):
Or for production (supervisor recommended):
⚙️ Configuration
config/visit-tracker.php:
- excluded_paths → Wildcards supported. Paths that will not be logged.
- excluded_methods → HTTP methods that will not be logged. Example:
['POST', 'PATCH']- these requests will not be logged. Leave empty array[]to log all methods. - log_bots → Set
trueto log bot visits. - ip_info_cache_duration → Cache IP info to reduce API calls.
- use_queue → Set
trueto use Laravel queues,falsefor synchronous processing. - log_payload → Set
trueto log request payload/body data. Set tofalseto disable payload logging for privacy/security reasons. - excluded_payload_fields → Fields to exclude from request payload logging (useful for sensitive data like passwords, tokens, etc.). Only applies if
log_payloadistrue. - attribute_on_auth → When
true, anonymous visits from the same browser are assigned to the user after login or registration. - visitor_cookie → Cookie name used to recognize anonymous visitors across session regenerations.
- visitor_cookie_minutes → Lifetime of the visitor cookie in minutes.
Attribute anonymous visits after login/register
When attribute_on_auth is enabled (default), the package:
- Stores a persistent
visitor_idcookie while the guest browses - Saves that
visitor_id(andsession_id) on each visit log - On
Login/Registered, updates matching rows whereuser_idis null
You can also do it manually:
💻 Usage
No extra code is required. Visit any web page and the visit is logged automatically.
Retrieve logs example:
Optional manual middleware:
📊 Statistics
The PageVisitLog model provides various static methods to retrieve statistics about your visits.
Note: The examples below are just some quick use functions. For detailed usage, you can query the model directly using Laravel's Eloquent methods to retrieve and manipulate the data as needed. All visit data is stored in the
page_visit_logstable and can be accessed through thePageVisitLogmodel.
Basic Statistics
Total Visits:
Unique Visitors:
Unique IP Addresses:
Page Statistics
Most Visited Pages:
Visits by Date Range:
Device & Browser Statistics
Statistics by Device Type:
Statistics by Browser:
Statistics by Platform:
Referrer Statistics
Top Referrers:
Time-based Statistics
Daily Statistics:
Geographic Statistics
Statistics by Country:
Summary Statistics
Get All Statistics at Once:
Query Scopes
Exclude Bots Scope:
Date Range Scope:
📜 License
MIT License © İbrahim Kaya
All versions of visit-tracker with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/queue Version ^9.0|^10.0|^11.0|^12.0|^13.0
illuminate/auth Version ^9.0|^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.9
hisorange/browser-detect Version ^5.0