Filter out bots from stats
This commit is contained in:
parent
b6365b113a
commit
4d6eae5f14
|
@ -6,6 +6,12 @@
|
|||
*/
|
||||
function goatcounter_record_hit(string $path)
|
||||
{
|
||||
if (isset($_SERVER["HTTP_USER_AGENT"])
|
||||
&& preg_match("/bot|crawl|slurp|spider|mediapartners/i", $_SERVER["HTTP_USER_AGENT"])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$token = file_get_contents(".goat.token");
|
||||
$ch = curl_init();
|
||||
|
||||
|
@ -17,7 +23,7 @@ function goatcounter_record_hit(string $path)
|
|||
"hits" => array(array(
|
||||
"path" => $path,
|
||||
"ip" => $_SERVER["REMOTE_ADDR"],
|
||||
"ref" => $_SERVER["HTTP_REFERER"],
|
||||
"ref" => $_SERVER["HTTP_REFERER"] ?? "",
|
||||
"user_agent" => $_SERVER["HTTP_USER_AGENT"]
|
||||
))
|
||||
))
|
||||
|
|
|
@ -107,7 +107,7 @@ if ($target != null && !$needs_confirmation) {
|
|||
$("#header").appendChild(header({title: "fwdkr.co"}));
|
||||
$("#footer").appendChild(footer({
|
||||
vcsURL: "https://git.fwdekker.com/FWDekker/fwdkr.co/",
|
||||
version: "v1.3.1"
|
||||
version: "v1.3.2"
|
||||
}));
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue