Liking cljdoc? Tell your friends :D

audience

Declarative, rule-based audience segmentation. Segments are defined in code with the defaudience macro or persisted dynamically in the database, then evaluated against your user base through a hybrid SQL
predicate pipeline.

Key namespaces

NamespacePurpose

wagoe.audience.shell.registry

In-process segment definition registry and the defaudience macro (mutable state, so shell)

wagoe.audience.core.filter

Pure: built-in filter types and the filter→sql / filter→predicate multimethods

wagoe.audience.core.compiler

Pure: compile segments into SQL + predicate execution plans

wagoe.audience.core.composition

Pure: AND/OR/NOT composition of segment result sets

wagoe.audience.core.ui

Pure: Hiccup UI components for segments

wagoe.audience.ports

Protocols: IAudienceResolver, IAudienceRepository, IAudienceCache, IUserDataSource

wagoe.audience.shell.service

Service orchestrating resolution, caching, and persistence

wagoe.audience.shell.persistence

IAudienceRepository — DB persistence (next.jdbc + HoneySQL)

wagoe.audience.shell.cache

IAudienceCache — DB-backed cache of evaluated results

wagoe.audience.shell.http

REST + web endpoints (CRUD, preview, evaluate, members)

Built-in filter types

FilterMatches on

:demographics

Age, gender, and other profile attributes

:location

Country, region, city

:role

Assigned user roles

:account-tenure

Time since account creation

:last-active

Recency of last activity

:behavior

Recorded user events / actions

:feature-usage

Use of specific product features

Each filter is resolved through the filter→sql and filter→predicate multimethods. SQL-eligible filters are pushed to the database; the rest run as Clojure predicates over the candidate set. Define new methods on both multimethods to add custom filter types.

Composition

Segments compose with AND / OR / NOT. A composition tree is checked before it is evaluated: circular, unknown or invalid references are rejected then.

Dynamic segments

Segments can also be stored in the database as JSON and loaded at runtime. Incoming JSON is schema-validated, and fn-typed values are rejected so persisted definitions stay data-only.

Caching

Membership results are cached in an audience_memberships table with a configurable per-segment TTL, served through the IAudienceCache component.

Builder UI

A segment builder is served over HTMX, with Replicant widget mount points for the filter panel and the composition builder.

Endpoints

Endpoint groupPurpose

CRUD

Create, read, update, delete segments

Preview

Count + sample of matching members

Evaluate

Run evaluation and cache the result

Members

List cached members of a segment

Can you improve this documentation? These fine people already did:
Thijs Creemers & thijscreemers
Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close