Pluggable chain-of-influence attribution for the Coseller Protocol.
weigh-chain is a multimethod dispatched on the algorithm name (a string).
It turns a buyer's touches into an ordered chain of cosellers with relative
weights. allocate then distributes an integer pool across those weights
using the largest-remainder method so the splits always sum exactly to the
pool — no rounding drift, no minted or lost units.
Adding a new attribution model = one new defmethod weigh-chain plus a new
value the GM may set as :algorithm on the policy. Nothing else changes.
Pluggable chain-of-influence attribution for the Coseller Protocol. `weigh-chain` is a multimethod dispatched on the algorithm name (a string). It turns a buyer's touches into an ordered chain of cosellers with relative weights. `allocate` then distributes an integer pool across those weights using the largest-remainder method so the splits always sum exactly to the pool — no rounding drift, no minted or lost units. Adding a new attribution model = one new `defmethod weigh-chain` plus a new value the GM may set as `:algorithm` on the policy. Nothing else changes.
The set of registered attribution algorithm names.
The set of registered attribution algorithm names.
(allocate pool weights)Distribute the integer pool across weights (a seq of [coseller weight])
using the largest-remainder method, so the integer splits always sum exactly
to pool. Ties on the fractional remainder break toward earlier entries
(stable, chain order). Returns {coseller {:amount <int> :weight-bps <int>}}.
Empty weights, non-positive total weight, or a non-positive pool yield {}.
Distribute the integer `pool` across `weights` (a seq of `[coseller weight]`)
using the largest-remainder method, so the integer splits always sum exactly
to `pool`. Ties on the fractional remainder break toward earlier entries
(stable, chain order). Returns `{coseller {:amount <int> :weight-bps <int>}}`.
Empty weights, non-positive total weight, or a non-positive pool yield `{}`.(registered? algorithm)Given an algorithm name and a context map {:touches :as-of :window-days},
return an ordered vector of [coseller weight] pairs — the eligible
chain-of-influence in influence order. Distinct cosellers only; weights are
relative (not currency amounts).
Given an algorithm name and a context map `{:touches :as-of :window-days}`,
return an ordered vector of `[coseller weight]` pairs — the eligible
chain-of-influence in influence order. Distinct cosellers only; weights are
relative (not currency amounts).cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |