usage
What people do in a program, and the web's own numbers (visitors, visits, pageviews, bounces, sources and campaigns, countries, browsers and devices, goals, who is here now, how fast each page loaded), in the program's own database and on its own admin page. The whole of it is docs/usage.md, with a table of what is collected.
# mote.toml[packages]usage = "../mote/extensions/usage"app "Shop" usage=onuse "pkg:usage/usage.mote"fn usageMay(): bool let me = auth.me()? return me?.email == "owner@shop.example"// Optional: what counts as a visit reaching what it is for.fn usageGoals(): string[] = ["checkout", "/thanks"]route "/admin/usage" UsagePanel| File | |
|---|---|
usage.mote | The models of events, counts and people, the server on usage block that keeps each batch (usageTake(batch, app?)), a visitor joined to the account they sign in or up as, the night's prune, and the questions (usagePeople, usageTop, usageSeries, usageBreakdown, usageFunnel, usageRetention). |
visits.mote | Visits, kept as each batch comes in: pageviews, entrances and exits, bounces, time in front, a visit's source, campaign, country and browser, each value's visitors, goals, speed (UsageLive, UsageDim, UsageVisitor, UsageVital), who is here now as the pages' open lines say (UsageHere), and their questions (usageOverview, usageDims, usageNow, usageGoalsSeen, usageGoalBy, usageVitalsSeen). wants fn usageGoals, wants fn usageGoalsFor(app). |
web.mote | Plain fns, no database: the User-Agent reader (usageTechOf), the time zones' countries (usageZoneCountry), where a visit came from (usageSourceClass, usageSourceName), the buckets, the flags, the rules a visit is cut and called a bounce by. |
panel.mote | UsagePanel, UsageOverview, UsageNow, UsagePages, UsageSources, UsageCountries, UsageDevices, UsageGoals, UsageVitals, UsagePeople, UsageTop, UsageChart, UsageFunnel, UsageRetention. Taken by usage.mote. |
analytics.mote | Product analytics (docs/analytics.md): log UsageLog (with the capture door) and fact UsageEvents, the seam into the log and the log into the store, people and what is known of them, cohorts, experiments, saved insights and dashboards, export, webhooks, the panel's questions. Takes usage.mote, features.mote, insights.mote, demo.mote. |
features.mote | Feature flags: on or off or a variant, a rollout, rules by property or cohort, PostHog's hash, exposures. |
insights.mote | AnalyticsPanel and its parts: trends, retention, new and returning, stickiness and lifecycle, funnels, paths, people, dashboards, flags and experiments, live. |
demo.mote | usageDemoSeed(app, people, days): eight weeks of a made-up shop, to show the panel with. |
analytics_tests.mote | The analytics part's tests (tests/e2d_analytics is the program that runs them). |
tests.mote | Its tests: use "pkg:usage/tests.mote" in a program whose usageMay admits admin@example.com (and whose usageGoalsFor("planner") is ["planned"]), then mote test. |
Several apps, one panel. A program handed other programs' batches (each
with usage=on and a server on usage that passes the batch over a signed
call) keeps each with usageTake(batch, "planner"), says no usage=on
itself so that its own pages are not counted, and shows one at a time with
UsagePanel app=which (every question takes app last, every component
app=). Unsaid, the app is "", the program's own, as it always was.
docs/usage.md.
Settings: USAGE_KEEP_DAYS (90), USAGE_ZONE (UTC),
USAGE_SESSION_MINUTES (30), USAGE_GOALS (with commas between),
USAGE_BOTS=keep (count crawlers, as the device bot),
USAGE_AUTOMATION=count (count a browser a program drives: for tests).
Where people are is the runtime's to find: MOTE_GEO_HEADER (with
MOTE_PROXY), MOTE_GEO_REGION_HEADER, MOTE_GEO_CITY_HEADER,
MOTE_GEO_DB.
extensions/usage/README.md