Rules¶
Rules define the conditions that Adwize monitors. When a condition is met, an alert is created. All rules are evaluated automatically every 15 minutes.
Rule Types¶
Threshold Rules¶
Alert when an event count exceeds or drops below a limit within a time window.
Use cases: Too many errors, payment failures, unusually high traffic.
| Parameter | Description |
|---|---|
event_type |
The event type to count |
source |
(optional) Filter by source |
field |
What to measure — typically count |
operator |
Comparison: >, <, >=, <=, == |
value |
The threshold number |
window_minutes |
Time window to look back |
severity |
critical, warning, or info |
Example: Alert when more than 10 payment failures in 60 minutes.
{
"name": "High Payment Failures",
"rule_type": "threshold",
"config": {
"source": "gtm",
"event_type": "payment_failed",
"field": "count",
"operator": ">",
"value": 10,
"window_minutes": 60,
"severity": "critical"
}
}
Missing Field Rules¶
Alert when required fields are absent from events.
Use cases: transaction_id missing on purchases, user_id missing on login events.
| Parameter | Description |
|---|---|
event_type |
The event type to inspect |
required_fields |
List of field names that must be present in data |
severity |
critical, warning, or info |
Example: Alert when purchases lack a transaction_id.
{
"name": "Purchase Missing Transaction ID",
"rule_type": "missing_field",
"config": {
"event_type": "purchase",
"required_fields": ["transaction_id"],
"severity": "critical"
}
}
Volume Rules¶
Alert when event volume changes significantly compared to a baseline period.
Use cases: Sudden traffic drop (broken tag), unexpected spike (bot traffic).
| Parameter | Description |
|---|---|
event_type |
The event type to monitor |
threshold_percent |
Percentage change to trigger (negative for drops) |
current_window_minutes |
Recent period to measure |
comparison_window_hours |
Baseline period to compare against |
severity |
critical, warning, or info |
Example: Alert when purchase volume drops 50% vs. the last 24 hours.
{
"name": "Purchase Volume Drop",
"rule_type": "volume",
"config": {
"event_type": "purchase",
"threshold_percent": -50,
"current_window_minutes": 60,
"comparison_window_hours": 24,
"severity": "critical"
}
}
Creating Rules¶
Via the UI¶
- Go to the Rules page.
- Click Create Rule.
- Fill in the rule configuration:
- Name — A descriptive name (e.g., "Purchase Missing Transaction ID").
- Rule Type — Threshold, Missing Field, or Volume.
- Config — Type-specific parameters (see rule types above).
- Tags — Optional labels for organization.
- Category — Optional grouping.
- Click Save.
The rule becomes active immediately and is evaluated on the next 15-minute cycle.
Via the AI Agent¶
Open the AI Assistant chat and describe what you want in plain English. The assistant creates the rule configuration for you, and can also suggest what you should be monitoring based on your event types. You can manage existing rules through the chat too — enable, disable, or delete rules by asking. See the AI Agents concept page for details.
Via the API¶
Create rules programmatically using the REST API. See the Rules API reference for full documentation.
Example:
curl -X POST https://api.getadwize.com/api/v1/rules/ \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "High Error Rate",
"rule_type": "threshold",
"config": {
"event_type": "error",
"field": "count",
"operator": ">",
"value": 10,
"window_minutes": 15,
"severity": "critical"
}
}'
Rule Lifecycle¶
Rules can be active or inactive. Only active rules are evaluated. You can pause a rule without deleting it by toggling it inactive.
Rules support tags and categories for organization and filtering. Use these to group rules by team, data source, or monitoring area.
Rule Examples¶
Detect Broken Tracking¶
{
"name": "Purchase Missing Transaction ID",
"rule_type": "missing_field",
"config": {
"event_type": "purchase",
"required_fields": ["transaction_id"],
"severity": "critical"
}
}
Detect Traffic Anomalies¶
{
"name": "Page View Volume Drop",
"rule_type": "volume",
"config": {
"event_type": "page_view",
"threshold_percent": -50,
"current_window_minutes": 60,
"comparison_window_hours": 24,
"severity": "warning"
}
}
Detect Too Many Failures¶
{
"name": "High Payment Failures",
"rule_type": "threshold",
"config": {
"source": "gtm",
"event_type": "payment_failed",
"field": "count",
"operator": ">",
"value": 10,
"window_minutes": 60,
"severity": "critical"
}
}
Best Practices¶
- Start with a few high-severity rules for your most critical events (purchases, sign-ups).
- Use
warningseverity for early indicators andcriticalfor things that need immediate attention. - Set volume rule baselines to at least 24 hours to smooth out daily patterns.
- Tag rules by team or data source for easier management.
- Review and adjust thresholds based on your alert history — rules that trigger too frequently or never trigger may need tuning.