Deploy Ladill Link / deploy (push) Successful in 32s
Record parsed user-agent and geo data on clicks, then surface breakdowns and richer recent-click context on per-link and account analytics views. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.2 KiB
PHP
31 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Link;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Link\LinkAnalyticsService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class AnalyticsController extends Controller
|
|
{
|
|
public function __construct(private LinkAnalyticsService $analytics) {}
|
|
|
|
public function index(Request $request): View
|
|
{
|
|
$account = ladill_account();
|
|
|
|
return view('links.analytics.index', [
|
|
'summary' => $this->analytics->summaryForAccount($account),
|
|
'dailyClicks' => $this->analytics->dailyClicksForAccount($account, 30),
|
|
'topLinks' => $this->analytics->topLinksForAccount($account),
|
|
'recentClicks' => $this->analytics->recentClicksForAccount($account),
|
|
'referrers' => $this->analytics->referrersForAccount($account),
|
|
'devices' => $this->analytics->breakdownForAccount($account, 'device_type'),
|
|
'browsers' => $this->analytics->breakdownForAccount($account, 'browser'),
|
|
'platforms' => $this->analytics->breakdownForAccount($account, 'os'),
|
|
'countries' => $this->analytics->breakdownForAccount($account, 'country'),
|
|
]);
|
|
}
|
|
}
|