Skip to content

Commit

Permalink
Merge pull request #67 from grantholle/type-issue
Browse files Browse the repository at this point in the history
Move logic to before determining user agent
  • Loading branch information
andreaselia authored Jul 30, 2024
2 parents 4983cc5 + 4f50ef4 commit 70633b3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Http/Middleware/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ public function handle(Request $request, Closure $next)
return $response;
}

foreach (config('analytics.exclude', []) as $except) {
if ($except !== '/') {
$except = trim($except, '/');
}

if ($request->fullUrlIs($except) || $request->is($except)) {
return $response;
}
}

$agent = new Agent();
if ($userAgent = $request->headers->get('user-agent')) {
$agent->setUserAgent($userAgent);
Expand All @@ -49,16 +59,6 @@ public function handle(Request $request, Closure $next)
}
}

foreach (config('analytics.exclude', []) as $except) {
if ($except !== '/') {
$except = trim($except, '/');
}

if ($request->fullUrlIs($except) || $request->is($except)) {
return $response;
}
}

$attributes = [
'session' => $this->getSessionProvider()->get($request),
'uri' => $uri,
Expand Down

0 comments on commit 70633b3

Please sign in to comment.