Skip to content

Commit

Permalink
make user agent check before setting
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaselia committed Jun 6, 2024
1 parent beb7d3e commit 4983cc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Binary file added .DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion src/Http/Middleware/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public function handle(Request $request, Closure $next)
}

$agent = new Agent();
$agent->setUserAgent($request->headers->get('user-agent'));
if ($userAgent = $request->headers->get('user-agent')) {
$agent->setUserAgent($userAgent);
}
$agent->setHttpHeaders($request->headers);

if (config('analytics.ignoreRobots', false) && $agent->isRobot()) {
Expand Down

0 comments on commit 4983cc5

Please sign in to comment.