Wraith.Analytics (Wraith v0.1.0)

View Source

Privacy-light analytics: no cookies, no IPs stored. A page view bumps two daily counters — the post's and the site's (STATS#<yyyy-mm-dd> / POST#<id> and SITE) — and a per-day set of visitor ids is kept (the anonymous visitor cookie's SHA-256, so "unique readers today" is a count, not a trail). Counts are batched in memory and flushed every few seconds so a busy page costs the store one write per post per flush.

Summary

Functions

Returns a specification to start this module under a supervisor.

Write pending counts now (tests, shutdown).

Record a view of post_id (or nil for the home page) by visitor.

Member sign-ups per day for the last days.

Views per day for the last days, site-wide or for one post: [%{day, views, uniques}].

Top posts by views over the last days.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

flush()

Write pending counts now (tests, shutdown).

hit(post_id, visitor)

Record a view of post_id (or nil for the home page) by visitor.

member_growth(days \\ 30)

Member sign-ups per day for the last days.

series(days \\ 30, post_id \\ nil)

Views per day for the last days, site-wide or for one post: [%{day, views, uniques}].

start_link(opts \\ [])

top_posts(days \\ 30, n \\ 10)

Top posts by views over the last days.