From 8269df919ed8fa1135552ea038292fd10bcfae80 Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Sun, 7 May 2023 18:20:42 +0200 Subject: [PATCH] Not showing in the google table rows unneeded. --- lib/BurguillosInfo/Tracking.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/BurguillosInfo/Tracking.pm b/lib/BurguillosInfo/Tracking.pm index 0df9b18..3977f6e 100644 --- a/lib/BurguillosInfo/Tracking.pm +++ b/lib/BurguillosInfo/Tracking.pm @@ -101,10 +101,11 @@ EOF return $data; } +my $GOOGLE_REFERER_REGEX = "'^https?://(?:www\\.)?google\\.\\w'"; my $GOOGLE_SELECT = "$SELECT_GLOBAL where requests.path = paths.path and requests.referer IS NOT NULL - and requests.referer ~* '^https?://(?:www\\.)?google\\.\\w' + and requests.referer ~* $GOOGLE_REFERER_REGEX and date > NOW()"; sub get_google_data { @@ -135,8 +136,11 @@ sub get_google_data { ( $GOOGLE_SELECT - interval '1 month' ) as unique_ips_last_month -FROM paths -WHERE paths.last_seen > NOW() - INTERVAL '1 month'; +FROM paths right join requests on paths.path = requests.path +WHERE paths.last_seen > NOW() - INTERVAL '1 month' + and requests.referer ~* $GOOGLE_REFERER_REGEX +GROUP BY + paths.path; EOF return $data; }