Skip to content

Commit

Permalink
adjust UA parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiLeni committed May 28, 2023
1 parent 41786f9 commit 9a5c79c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boot.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
$visit->saveBot();
} else {

if ($visit->shouldSaveVisit()) {
if ($visit->shouldSaveVisit() && !$visit->DeviceDetector->isLibrary()) {

// visitor is human
// check hash with save_visit, if true then save visit
Expand Down
12 changes: 12 additions & 0 deletions lib/Visit.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class Visit
'.js.map',
];

const IGNORE_UA = [
'REDAXO',
];


private DateTimeImmutable $datetime_now;

Expand Down Expand Up @@ -162,6 +166,14 @@ public function shouldIgnore(): bool
}
}

// check special user agents which should be ignored
foreach (self::IGNORE_UA as $el) {
if (str_starts_with($this->userAgent, $el)) {
return true;
}
}


return false;
}

Expand Down

0 comments on commit 9a5c79c

Please sign in to comment.