Add device, platform, and country analytics to link show page.
Deploy Ladill Link / deploy (push) Successful in 32s
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>
This commit is contained in:
@@ -21,6 +21,10 @@ class AnalyticsController extends Controller
|
||||
'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'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Link;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ShortLink;
|
||||
use App\Services\Link\LinkAnalyticsService;
|
||||
use App\Services\Link\LinkBillingService;
|
||||
use App\Services\Link\LinkCatalogSyncService;
|
||||
use App\Services\Link\LinkManagerService;
|
||||
@@ -18,6 +19,7 @@ class LinkController extends Controller
|
||||
private LinkManagerService $links,
|
||||
private LinkBillingService $billing,
|
||||
private LinkCatalogSyncService $catalogSync,
|
||||
private LinkAnalyticsService $analytics,
|
||||
) {}
|
||||
|
||||
public function index(Request $request): View
|
||||
@@ -73,7 +75,14 @@ class LinkController extends Controller
|
||||
|
||||
return view('links.show', [
|
||||
'link' => $link,
|
||||
'recentClicks' => $link->clicks()->latest('clicked_at')->limit(20)->get(),
|
||||
'summary' => $this->analytics->summaryForLink($link),
|
||||
'dailyClicks' => $this->analytics->dailyClicksForLink($link, 30),
|
||||
'devices' => $this->analytics->breakdownForLink($link, 'device_type'),
|
||||
'browsers' => $this->analytics->breakdownForLink($link, 'browser'),
|
||||
'platforms' => $this->analytics->breakdownForLink($link, 'os'),
|
||||
'countries' => $this->analytics->breakdownForLink($link, 'country'),
|
||||
'referrers' => $this->analytics->referrersForLink($link),
|
||||
'recentClicks' => $this->analytics->recentClicksForLink($link),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user