Track signal data with Statistics
Build reusable counters, totals, latest values, and calculations from one or more incoming signals without creating automations.
AlphaResult
Statistics lets Streaming Hub keep useful values from incoming signals even when no automation handles those signals.
After this guide, you will be able to:
- create a typed value under
stats.*; - update one Statistic from one or several signals;
- read a signal field, use a constant, or calculate an expression;
- replace, add, minimize, or maximize the stored value;
- filter and deduplicate each update rule independently;
- read the result from automations, macros, conditions, and templates.
How Statistics differs from Variables
A Variable is general project state. Actions can read and write it.
A Statistic is a read-only derived value. Users define how incoming signals update it, while automations and templates consume the result through stats.*. Actions cannot assign to a Statistic directly.
No donation, follower, subscription, or other value is collected automatically. A plugin must provide the signal, and you must explicitly create both the value and its update rules.
The Statistics workspace
Statistics keeps the complete value-and-rule workflow on one screen:
| Panel | What it defines |
|---|---|
| Statistic values | What is stored: key, type, initial value, scope, and current value. |
| Update rules | Which rules are enabled and quick actions to duplicate or delete them. |
| Value settings | Configuration and runtime state for the selected value. |
| Rule settings | How an incoming signal produces a value and where that value is applied. |
| Encyclopedia | The contract and fields of the signal selected by the current rule. |
The Values and Rules lists are separated by a splitter, as are Value settings and Rule settings. Value settings can be collapsed to give Rule settings more room without hiding either list. The Encyclopedia panel can also be collapsed.
This separation is important. One value can have any number of update rules, and each rule can listen to a different signal.
The data flow is:
Signal → Field / Constant / Expression → Replace / Add / Min / Max → stats.<key>
Step 1. Create a value
Open Statistics and choose Add beside Statistic values.
Configure:
| Field | Purpose |
|---|---|
| Enabled | Pauses all rules targeting this value without deleting it. |
| Name | Friendly name shown in the Statistics workspace. |
| Key | Stable path after stats., for example donation_total. |
| Description | Optional explanation for other project editors. |
| Value type | Number, Text, or Boolean. |
| Initial value | Value used when the Statistic is created or reset. |
| Scope | Session, Persistent, or Both. |
With the key donation_total, the primary read path is:
stats.donation_total
Keep keys short, stable, and unique. Changing a key also changes the path used by automations and templates.
Storage scopes
| Scope | Behavior |
|---|---|
| Session | Keeps a value for the current app/project session. |
| Persistent | Saves the value beside the project and restores it later. |
| Both | Maintains independent session and persistent values. |
For Both, you can explicitly read either lane:
stats.donation_total.session
stats.donation_total.persistent
The primary stats.donation_total path reads the persistent lane when scope is Both.
Step 2. Add an update rule
Choose Add beside Update rules. If a Statistic is selected, the new rule uses it as the initial destination.
The Rules list provides quick controls to enable or disable, duplicate, or delete each rule. Use Remove in the section header to delete the selected rule.
Give the rule a descriptive name, such as Add DonationAlerts amount. Then select Signal to open the same searchable signal picker used by automations.
The Encyclopedia panel on the right automatically follows the selected signal. Use its contract fields to see which paths the plugin sends. Encyclopedia can be collapsed when more editing space is needed.
Examples of possible sources include:
- DonationAlerts Donation Received;
- Twitch Follow;
- YouTube New Sponsor;
- OBS Stream Started;
- a signal supplied by any other installed plugin.
Step 3. Choose the incoming value
Each rule has one incoming-value source:
| Source | Use it for | Example |
|---|---|---|
| Field | Read one field from the incoming signal. | payload.amount |
| Constant | Use the same value whenever the signal arrives. | 1 |
| Expression | Calculate a value from event fields, Variables, Statistics, or current. | {payload.amount} * 1.5 |
For Field, choose a contract path from the list or type the exact path shown in Encyclopedia.
In an Expression, current means the current value of the destination Statistic. For example:
current + {payload.amount}
When scope is Both, the expression is evaluated independently for the session and persistent lanes. This lets one lane continue from its own current value after the other is reset.
Step 4. Choose the destination and apply mode
Select the destination Statistic, then choose how the incoming value affects it:
| Apply mode | Result |
|---|---|
| Replace | Stores the incoming value as the new value. |
| Add | Adds the incoming number to the current number. |
| Minimum | Keeps the smaller of the current and incoming numbers. |
| Maximum | Keeps the larger of the current and incoming numbers. |
Add, Minimum, and Maximum are available only for Number Statistics. Text and Boolean Statistics use Replace.
The preview summarizes the completed mapping before a signal arrives.
Common recipes
| Goal | Incoming source | Incoming value | Apply mode |
|---|---|---|---|
| Count donations | Constant | 1 | Add |
| Sum donation amounts | Field | payload.amount | Add |
| Keep the latest donor name | Field | payload.username | Replace |
| Keep the largest donation | Field | payload.amount | Maximum |
| Add a weighted amount | Expression | {payload.amount} * 1.5 | Add |
| Calculate the complete next value | Expression | current + {payload.amount} | Replace |
Do not combine current + value with Add unless you intentionally want to add the complete calculated result again.
Step 5. Update one Statistic from several signals
Create another update rule and select the same destination Statistic.
For example, stats.support_points can receive:
- a Donation Received rule that adds
payload.amount; - a New Subscription rule that adds the constant
5; - a Manual Reward rule that adds
payload.points.
The rules are independent. A filter, error, or duplicate in one rule does not prevent another matching rule from updating the destination.
Step 6. Configure advanced rule behavior
Open Advanced on an update rule.
Filter
Leave Filter field empty to accept every occurrence of the selected signal. To accept only matching events, set a field and expected value:
| Field | Example |
|---|---|
| Filter field | payload.currency |
| Expected filter value | USD |
The comparison is case-insensitive. A missing or different value does not match the rule.
Missing field
This policy applies when a Field source cannot be resolved:
| Policy | Behavior |
|---|---|
| Ignore | Records the match as ignored and leaves the Statistic unchanged. |
| Use fallback | Uses the configured fallback value. |
| Error | Leaves the Statistic unchanged and records an error on the rule. |
Deduplication
Keep Ignore duplicate correlation IDs enabled when a connector may deliver the same event more than once.
Deduplication is scoped to one update rule. Two different rules may intentionally process the same correlation ID once each.
Step 7. Verify rule diagnostics
Trigger or test the selected signal, then inspect the rule:
- Status changes from Waiting to Active after a successful update;
- Last matched shows when the rule received its latest accepted signal;
- Last input shows the resolved incoming value;
- Last result shows the destination value after applying the rule;
- Processed events counts successful updates;
- Ignored duplicates counts repeated correlation IDs;
- Last error explains an invalid field, expression, type conversion, or destination.
The Values list shows the combined current value and how many rules target each Statistic.
Step 8. Read Statistics
Open Insert Field and select the Stats tab to copy or insert configured paths. The same category is available in the Insert Field popup opened with the configured hotkey (Ctrl+Space by default).
Use a raw path in conditions and source fields:
stats.donation_total
Use braces in templates:
We have received {stats.donation_total} in donations this stream.
Statistics are read-only. Write targets must use vars.* or runtime.*; actions such as Set Variable, Increment Value, Math Number Operate, and Random cannot target stats.*.
Step 9. Export or import current values
Statistic definitions and update rules are part of the core project configuration.
When exporting a project, enable Current statistics values if the export should also contain current session and persistent values. Leave it disabled when another user should start from the initial value of each Statistic.
During import:
- importing the core project brings in values and update rules;
- importing Current statistics values restores values for matching Statistic IDs;
- current values can be imported separately into an already loaded matching project.
Verify the complete setup
- Create a typed Statistic from the Values list.
- Add an update rule.
- Select its real signal through the signal picker.
- Select Field, Constant, or Expression.
- Select the destination and apply mode.
- Trigger or test the signal.
- Confirm the rule diagnostics and destination value changed.
- Insert
stats.<key>into an automation condition or Log template and test it.
If it does not work
- Status stays Waiting: confirm the rule and destination are enabled, the plugin is connected, and the selected signal actually arrived.
- Field was not found: copy the exact path from the selected signal contract in Encyclopedia.
- The selected field is not numeric: use Replace with a Text Statistic, or select a numeric field for Add, Minimum, and Maximum.
- Expression reports an error: verify every placeholder and ensure a numeric expression produces a finite number.
- Some events are ignored: review the rule filter, missing-field policy, and correlation-ID deduplication.
- The value resets after restart: use Persistent or Both instead of Session.
- An automation cannot write to the Statistic: this is intentional; edit its update rules or write to a Variable instead.
- A plugin signal is missing: install, enable, or reconnect the plugin that provides it.