aboutsummaryrefslogtreecommitdiffstats
path: root/lib/register.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-03 23:10:20 -0700
committerAdam Soltys <[email protected]>2026-06-03 23:10:20 -0700
commit183a3cb03e9ca04a0b1433fa2850a47747de00d6 (patch)
tree1107722f1171418968bc44d7c8d47ef2e42c29e0 /lib/register.ts
parent6372d9185021aeb379e8c67386ba72f7b0aa4bdd (diff)
downloadcoinos-server-183a3cb03e9ca04a0b1433fa2850a47747de00d6.tar.gz
coinos-server-183a3cb03e9ca04a0b1433fa2850a47747de00d6.zip
analytics: monthly insight reports + signup instrumentation
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) <[email protected]>
Diffstat (limited to 'lib/register.ts')
-rw-r--r--lib/register.ts3
1 files changed, 3 insertions, 0 deletions
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);
}