ad blockers resistent code

This commit is contained in:
Doar Mihai
2026-03-24 22:42:31 +02:00
parent ce8c95880a
commit 671386c035
4 changed files with 40 additions and 5 deletions
@@ -18,7 +18,12 @@ class TrackingScriptController extends Controller
->header('Content-Type', 'application/javascript');
}
$collectUrl = route('collect.store');
// Use ad-blocker resistant endpoint if script is loaded from /cdn/resources/
// Otherwise use the original endpoint for backward compatibility
$currentRoute = request()->route()->getName();
$collectUrl = $currentRoute === 'tracking.script.alt'
? route('collect.store.alt')
: route('collect.store');
$js = view('tracking.tracker', [
'trackingId' => $trackingId,