1. Go to this page and download the library: Download ibrahim-eng12/trackora library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
Route::middleware(['trackora.track'])->group(function () {
// Your routes here
});
use IbrahimEng12\Trackora\Models\Visitor;
// Track current request
Visitor::track($request);
// Track with custom page
Visitor::track($request, 'custom-page-name');
return [
// URL prefix for dashboard (e.g., /trackora)
'route_prefix' => 'trackora', // You can change the ROUTE for the Trackora dashboard of trackora HERE!
// Middleware for dashboard routes
'middleware' => ['web', 'auth'], // here you can add Role middleware like role:admin to allow only admin auth access
// Users allowed to access dashboard (empty = all authenticated users)
'allowed_users' => [], // here you can add IDs like 1 OR 1, 2 to allow only these users dashboard access
// Enable/disable tracking globally
'enabled' => env('TRACKORA_ENABLED', true),
// Track authenticated users
'track_authenticated' => true,
// Track bots/crawlers
'track_bots' => false,
// Paths to exclude from tracking (supports wildcards)
'excluded_paths' => [
'admin/*',
'api/*',
'livewire/*',
'_debugbar/*',
],
// IPs to exclude from tracking
'excluded_ips' => [],
// Geolocation settings
'geolocation' => [
'enabled' => true,
'provider' => 'ip-api',
],
// Data retention (days, null = forever)
'retention_days' => 90,
// Database table name
'table_name' => 'trackora_visits',
// Dashboard settings
'dashboard' => [
'per_page' => 25,
'default_period' => 30,
'chart_colors' => [
'primary' => '#3b82f6',
'secondary' => '#10b981',
],
],
];
use IbrahimEng12\Trackora\Models\Visitor;
// Counts
Visitor::getTotalCount(); // Total visits
Visitor::getUniqueCount(); // Unique visitors
Visitor::getTodayCount(); // Today's visits
Visitor::getTodayUniqueCount(); // Today's unique visitors
Visitor::getCountByDate('2024-01-15');
Visitor::getCountBetweenDates('2024-01-01', '2024-01-31');
// Analytics
Visitor::getTopPages(10); // Top visited pages
Visitor::getTopBrowsers(10); // Browser statistics
Visitor::getTopPlatforms(10); // Platform statistics
Visitor::getDeviceTypeStats(); // Device type breakdown
Visitor::getDailyStats(30); // Daily stats for N days
Visitor::getTopCountries(10); // Country statistics
Visitor::getTopCities(10); // City statistics
Visitor::getTopReferrers(10); // Referrer statistics
// Maintenance
Visitor::purgeOldRecords(); // Purge based on retention_days config