Every change an operator can make to the module — settings, the tracking
switch, a manual retention pass, a salt rotation — in one place, each logged
to PhoenixKit.Activity with the acting user.
All functions take opts with :actor_uuid (LiveViews pass
PhoenixKitWeb.Actor.opts(socket)). Activity metadata carries setting
names and counts, never the salt.
Summary
Functions
Replaces the visitor salt. Visitor IDs computed after this don't match the ones before, so today's visitors are counted again and open sessions split.
Runs a rollup + prune pass now and logs what it did.
Saves the settings form. Every field present in params is validated;
fields that fail keep their previous value and are returned by name.
Switches tracking on or off (the module toggle).
Types
@type opts() :: [{:actor_uuid, String.t() | nil}]
Functions
@spec rotate_salt(opts()) :: :ok | :error
Replaces the visitor salt. Visitor IDs computed after this don't match the ones before, so today's visitors are counted again and open sessions split.
@spec run_retention(opts()) :: %{ rolled_up: non_neg_integer(), pruned: non_neg_integer() }
Runs a rollup + prune pass now and logs what it did.
Saves the settings form. Every field present in params is validated;
fields that fail keep their previous value and are returned by name.
Returns {:ok, changed_keys}, {:error, invalid_fields} (nothing saved
when any field is invalid), or {:error, :not_saved} when a write failed.
Writes stop at the first failure; the ones before it are saved. They are
not one transaction on purpose: core announces each setting change (cache,
history, broadcast) as its write returns, so wrapping them would announce
values that weren't committed yet.
Switches tracking on or off (the module toggle).