From 33de17fa10e4fc7f44456cfbb3152fd16c86a567 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 14 Jun 2026 12:36:43 -0700 Subject: analytics: monthly insight reports + signup instrumentation Port of master 183a3cb0 + 3db24424. scripts/analytics.ts streams live db (SCAN, never KEYS) and reports a trailing window: MAU/WAU, new users, custody total + top holders, network volume by type, most-active/highest- volume users, bolt12 recipients; --csv flag for month-over-month trends. scripts/analytics-geo.ts reports top countries from the request log. lib/register.ts stamps `created` and stores `country` on new users so reports get signup timing/geography from the db directly. Note: these scripts were written against the master stack; on staging balances live in TigerBeetle, so custody/holder figures may need the balance source adjusted from the Redis balance: keys. Co-Authored-By: Claude Opus 4.8 --- lib/register.ts | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/register.ts b/lib/register.ts index b26acd6d..3f612ec3 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 { @@ -48,6 +50,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