From 050efc586b961f46f6e917cb8e4f522234f975cc Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sun, 9 Feb 2025 13:48:57 +0100 Subject: little draft on visit stats --- webstats/queries.sql | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 webstats/queries.sql (limited to 'webstats/queries.sql') diff --git a/webstats/queries.sql b/webstats/queries.sql new file mode 100644 index 0000000..2a3f762 --- /dev/null +++ b/webstats/queries.sql @@ -0,0 +1,21 @@ +#lang cl-yesql/sqlite + +-- name: create-stats-table +-- Creates table for tracking visits +CREATE TABLE IF NOT EXISTS STATS ( + timestamp int DEFAULT (unixepoch()) NOT NULL, + click text, + page text, + referrer text, + ip text, + user_agent text, + title text) + +-- name: drop-stats-table +-- Removes table tracking visits +DROP TABLE IF EXISTS STATS + +-- name: insert @last-id +-- Insert a data point +INSERT INTO STATS (click, page, referrer, ip, user_agent, title) + VALUES (:click, :page, :referer, :ip, :user_agent, :title) -- cgit v1.2.3