aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-14 12:36:43 -0700
committerAdam Soltys <[email protected]>2026-06-17 07:47:48 -0700
commit33de17fa10e4fc7f44456cfbb3152fd16c86a567 (patch)
tree7c57aa4e71892ec620bdee8ad51ef7c2b073e63b /lib
parent51847c5e05ad70e936fd374e01e62e0e4b5e3c72 (diff)
downloadcoinos-server-33de17fa10e4fc7f44456cfbb3152fd16c86a567.tar.gz
coinos-server-33de17fa10e4fc7f44456cfbb3152fd16c86a567.zip
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 <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/register.ts3
1 files changed, 3 insertions, 0 deletions
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);
}