feat: Add UTM parameters, interactive date range filter, cleaned referrer domains, and visitor city tracking to analytics

This commit is contained in:
Bartłomiej Janczak
2026-06-01 13:24:02 +02:00
parent 2ab85dd264
commit 69f6cef31b
20 changed files with 646 additions and 170 deletions

View File

@@ -6,6 +6,7 @@ use Bjanczak\FilamentShortUrl\Models\ShortUrl;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
class SyncBufferedCountersCommand extends Command
{
@@ -21,12 +22,12 @@ class SyncBufferedCountersCommand extends Command
$dirtyKey = "{$prefix}dirty_ids";
// Pull the list atomically to avoid race conditions with incoming clicks
if (Cache::getDefaultDriver() === 'redis' && class_exists(\Illuminate\Support\Facades\Redis::class)) {
$tempKey = "{$dirtyKey}:temp:" . time();
if (Cache::getDefaultDriver() === 'redis' && class_exists(Redis::class)) {
$tempKey = "{$dirtyKey}:temp:".time();
try {
\Illuminate\Support\Facades\Redis::rename($dirtyKey, $tempKey);
$dirtyIds = \Illuminate\Support\Facades\Redis::smembers($tempKey);
\Illuminate\Support\Facades\Redis::del($tempKey);
Redis::rename($dirtyKey, $tempKey);
$dirtyIds = Redis::smembers($tempKey);
Redis::del($tempKey);
} catch (\Throwable) {
// If key does not exist or rename fails, fallback
$dirtyIds = [];