From 183a3cb03e9ca04a0b1433fa2850a47747de00d6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 3 Jun 2026 23:10:20 -0700 Subject: analytics: monthly insight reports + signup instrumentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit scripts/analytics.ts — streams live db (SCAN, never KEYS) and reports for a trailing window (default 30d): MAU/WAU, new users, custody total + top holders, network volume by type (lightning/liquid/bitcoin/internal/bolt12/ fund), most-active and highest-volume users, and bolt12 recipients with a "regular" flag for the Ocean mining-reward stream. scripts/analytics-geo.ts — top countries from the request log. Counts only /login + /register events tied to a username (raw cf-ipcountry volume is dominated by datacenter/nostr traffic). Surfaces a distinct-IP-per-country column so proxy/VPN egress is visible, and filters a known credential-test bot IP. Honest result: US #1, then GB/CA/JP/DE/ES/BR. lib/register.ts — stamp `created` (ms epoch) and store `country` (CF/ ipregistry code) on new users, so future reports get real signup timing and geography from the db directly instead of log archaeology. Existing users predate this; backfill is out of scope. Co-Authored-By: Claude Opus 4.8 (1M context) --- lib/register.ts | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/register.ts') diff --git a/lib/register.ts b/lib/register.ts index a74ea640..bd1049c8 100644 --- a/lib/register.ts +++ b/lib/register.ts @@ -36,6 +36,8 @@ export default async (user, ip) => { }); } + user.created = Date.now(); + user.currency = "USD"; if (config.ipregistry) { try { @@ -46,6 +48,7 @@ export default async (user, ip) => { ).json(); user.currency = countries[code]; + user.country = code; // stored for analytics (signup geography) } catch (e) { warn("unable to detect country from IP", username); } -- cgit v1.2.3