Rules — automate your ad management
Last updated: May 19, 2026
Rules — automate your ad management
Rules Engine = if-then automation for your ads. Wevion evaluates every active rule every 15 minutes (cron with 2-minute offset) and acts on matching campaigns / ad sets / ads via SQS workers. Companion to Ads Manager (PRD-16): Ads Manager monitors, Rules Engine acts. Use cases: pause losers automatically, scale winners, protect daily spend, get alerted on anomalies.
Who is this for
Mediabuyers who want to stop doing repetitive manual actions ("pause every campaign with CPA > X for 3 days") and instead let the platform handle the routine + focus on strategy. Especially valuable when managing 10+ active campaigns where manual scanning every morning becomes a bottleneck.
What a rule is
A rule has 5 parts:
Scope — which ad accounts + which entity level (campaign / adset / ad) + entity filter (name contains, status)
Conditions — one or more
{metric, operator, value, time_range}combined with AND / OR logicActions — what to do when conditions match (pause, activate, increase / decrease budget %, relaunch, notify only)
Schedule —
interval(every N min) ordaily_at_time(extensions)Protections — cooldown, max executions per day, budget change caps
Status is one of paused / active / error. New rules start paused — toggle to active when ready.
How evaluation works
Wevion runs a cron job in apps/backend/src/server.ts every 15 minutes (with a 2-minute offset). Each tick:
Cron selects rules where
status = activeANDlast_evaluated_at < 15 min agoUpdates
last_evaluated_atfirst (prevents duplicate enqueue if a tick overlaps)Enqueues message to SYNC SQS queue (50 max in-flight, 15-min visibility timeout, 20 max attempts)
evaluate-rules.worker.tsfetches latest metrics + checks conditionsFor matching entities: enqueues to
execute-rule-action.worker.tsWorker performs the action on the platform (Meta / Google / TikTok / etc.)
Records execution in
automation_rule_executiontable + audit log
Reality check: "every 15 min" is the minimum cadence. Sub-15-min evaluation is not supported by design — protects against runaway loops + respects platform rate limits.
Use cases
Pause losers
IF cpa > 30 AND spend > 50 FOR last_7d
THEN pause adset
COOLDOWN 360 min
Kills underperforming ad sets without you logging in every morning.
Scale winners
IF roas > 3 AND spend > 100 FOR last_3d
THEN increase_budget_pct 20
COOLDOWN 720 min, MAX 3/day
Scales winners by 20% up to 3 times per day, then waits the cooldown.
Protect daily spend
IF budget_spent_pct > 80 FOR today
THEN notify_only
Alerts you when 80% of daily budget consumed — manual decision on extra budget.
Frequency cap
IF frequency > 5 FOR last_7d
THEN pause adset
Prevents creative fatigue auto-burning audiences.
Where it lives in the app
Route /rules. Sidebar entry Rules. Pages:
List (
/rules) — all rules with status + last execution + next fire timeBuilder (
/rules/new,/rules/:id/edit) — create / editDetail (
/rules/:id) — execution history + metrics snapshotsTemplates (
/rules/templates) — pre-built rules to fork
Cross-platform rules
Cross-platform rules (rules that span Meta + Google + TikTok + LinkedIn + Taboola in one rule) sit behind the ENABLE_CROSS_PLATFORM_RULES feature flag. 7 metrics supported (spend, spend_pct, impressions, clicks, ctr, cpc, cpm, purchases, purchase_value, roas, cpa) with 5 operators. See rul-117 extensions.
What you'll see
In /rules:
Table: rule name, status badge, entity level, schedule, last fired, execution count
Per-row actions: Edit, Pause / Resume, Duplicate, Delete, View executions
Top toolbar: New rule, From template, Bulk actions
In execution history:
Timeline of fires with entity counts (evaluated / matched / acted / skipped / errored)
Per-entity result with before / after values + metric snapshot
Key concepts to learn next
Create your first rule — step-by-step
Available metrics — what you can measure
Templates — pre-built rules to fork
Protections — keep automation safe
Best practices
Start narrow
First rule: target ONE ad account, ONE entity level, ONE condition. Watch execution history for a week. Then expand scope.
Preview before activating
Every new rule: use preview / dry-run to see what would have matched. Avoids surprises on first fire.
Use notify_only when learning
For rules you're unsure about (new metric, new threshold): start with notify_only action. Validate matches are correct over 1-2 weeks. Then switch to actual action (pause / scale).
Conservative cooldowns
For destructive actions (pause, decrease_budget_pct): cooldown ≥ 360 min default. Prevents thrashing on noisy metrics.
Related
Create your first rule — step-by-step builder
Templates — pre-built starting points
Bulk actions in Ads Manager — manual alternative