承接 ibrahim-eng12/trackora 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ibrahim-eng12/trackora

Composer 安装命令:

composer require ibrahim-eng12/trackora

包简介

Trackora - A powerful Laravel package to track and analyze website visitors with detailed statistics, browser detection, geolocation, and a beautiful dashboard.

README 文档

README

Trackora

Trackora

A powerful Laravel package to track and analyze website visitors with detailed statistics, browser detection, geolocation, and a beautiful dashboard with light/dark mode support.

Features

  • Track website visitors automatically with middleware
  • Browser and platform detection
  • Device type detection (Desktop, Mobile, Tablet)
  • Geolocation support (country, city)
  • Unique visitor tracking per day
  • Beautiful responsive dashboard with statistics
  • Light/Dark mode toggle with persistent preference
  • Export data to CSV or JSON
  • Configurable data retention
  • Bot/crawler filtering
  • API endpoint for statistics

Requirements

  • PHP 8.1+
  • Laravel 10.0+

Installation

Install the package via Composer:

composer require ibrahim-eng12/trackora

Publish the configuration, migration, and asset files:

php artisan vendor:publish --tag=trackora-config
php artisan vendor:publish --tag=trackora-migrations
php artisan vendor:publish --tag=trackora-assets

Run the migrations:

php artisan migrate

Usage

Automatic Tracking with Middleware

Add the tracking middleware to your routes or middleware groups:

Option 1: Global middleware (in bootstrap/app.php for Laravel 11+):

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \IbrahimEng12\Trackora\Http\Middleware\TrackVisitor::class,
    ]);
})

Option 2: Route middleware (in app/Http/Kernel.php for Laravel 10):

protected $middlewareGroups = [
    'web' => [
        // ... other middleware
        \IbrahimEng12\Trackora\Http\Middleware\TrackVisitor::class,
    ],
];

Option 3: Per-route middleware:

Route::middleware(['trackora.track'])->group(function () {
    // Your routes here
});

Manual Tracking

You can also track visitors manually:

use IbrahimEng12\Trackora\Models\Visitor;

// Track current request
Visitor::track($request);

// Track with custom page
Visitor::track($request, 'custom-page-name');

Configuration

After publishing, the configuration file will be available at config/trackora.php:

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',
        ],
    ],
];

Accessing the Dashboard

Visit /trackora (or your configured route prefix) to access the dashboard.

Statistics Methods

The Visitor model provides several static methods for statistics:

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

API Endpoint

The package provides a JSON API endpoint at /trackora/stats:

GET /trackora/stats?period=30

Response:

{
    "total_visits": 1250,
    "unique_visitors": 850,
    "today_visits": 45,
    "today_unique": 32,
    "daily_stats": [...],
    "top_pages": [...],
    "top_browsers": [...],
    "top_platforms": [...],
    "device_stats": [...],
    "top_countries": [...]
}

Customizing Views

Publish the views to customize the dashboard:

php artisan vendor:publish --tag=trackora-views

Views will be published to resources/views/vendor/trackora/.

Publishing Assets

If you need to customize the dashboard assets (logo, etc.):

php artisan vendor:publish --tag=trackora-assets

Assets will be published to public/vendor/trackora/.

Restricting Dashboard Access

By User ID or Email

Add specific user IDs or emails to the allowed_users config:

'allowed_users' => [
    1,                          // User ID
    'admin@example.com',        // Email
],

By Custom Logic

Create your own middleware that extends AuthorizeTrackoraDashboard:

namespace App\Http\Middleware;

use IbrahimEng12\Trackora\Http\Middleware\AuthorizeTrackoraDashboard;

class CustomTrackoraAuthorization extends AuthorizeTrackoraDashboard
{
    protected function isAuthorized($request): bool
    {
        return $request->user()?->isAdmin();
    }
}

Scheduled Cleanup

To automatically purge old records, add this to your scheduler:

// In app/Console/Kernel.php or routes/console.php
Schedule::call(function () {
    \IbrahimEng12\Trackora\Models\Visitor::purgeOldRecords();
})->daily();

License

MIT License. See LICENSE for details.

ibrahim-eng12/trackora 适用场景与选型建议

ibrahim-eng12/trackora 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 5, 最近一次更新时间为 2026 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「geolocation」 「analytics」 「laravel」 「statistics」 「visitor」 「tracking」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ibrahim-eng12/trackora 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ibrahim-eng12/trackora 我们能提供哪些服务?
定制开发 / 二次开发

基于 ibrahim-eng12/trackora 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 32
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-04