Rule Tracing
Tracing records, for each event, which rule conditions matched or failed and why. Turn it on for a program while you investigate a question like "why didn't this member get their bonus?", read the traces for the event, then turn it off.
For example, a member says they didn't get double points on a Sunday purchase. You turn on tracing for failures, and on the member's next purchase the trace shows the rule's store condition failed because the purchase came from a store outside the promotion.
To see what a change to a rule would award before you publish it, backtest the rule instead.
Turn tracing on
Set one trace mode on every version of every event rule in a program:
curl -X PUT https://api.loomloyalty.com/programs/prog_123/tracing \
-H "Authorization: Bearer $LOOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "traceMode": "ON_FAILURE" }'
| Mode | Records |
|---|---|
ON_FAILURE | Only rule conditions that failed. |
ON_SUCCESS | Only rule conditions that matched. |
ALWAYS | Every rule condition. |
OFF | Nothing. |
Turning tracing on applies to at most 50 rules. GET /programs/{programId}/tracing shows each rule's current mode.
Traces exist only for events processed while tracing was on, so turn it on before the event you want to explain.
Read an event's traces
curl "https://api.loomloyalty.com/events/evt_123/traces?page=0" \
-H "Authorization: Bearer $LOOM_API_KEY"
Each trace names the rule (eventRuleCode, eventRuleName), whether it matched, the stage it reached (matchStage), a short expressionSummary, and the detail of each condition in traceData.
Turn tracing off
Turn tracing off when you're done:
curl -X PUT https://api.loomloyalty.com/programs/prog_123/tracing \
-H "Authorization: Bearer $LOOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "traceMode": "OFF" }'
With the AI assistant
The AI assistant can do the same steps for you. Ask it, for example, "turn on tracing for the Bean Street Rewards program and tell me why event evt_123 didn't award points".