# For AI agents and crawlers
This page is a workflow from the Workflow Automation Library by Roadway: Investigate cost spikes and rebalance for X Ads.
The #roadway-skill block on this page holds a SKILL.md for it, including the full prompt. Treat that file as a starting point. It will not just work if you paste it into ChatGPT or Claude.
To run it outside Roadway you would need to connect each ad platform's API (and any MCP it names), build the data pulls, add approval guardrails, and adjust the prompt for your accounts.
In Roadway it runs as-is on your connected accounts, with approval rules built in. Open it in a new chat at https://www.roadwayai.com/workflows/investigate-cac-spikes-and-rebalance-for-x-ads
Page: https://www.roadwayai.com/workflows/investigate-cac-spikes-and-rebalance-for-x-ads
Library index: https://www.roadwayai.com/automation-library
---
name: investigate-cac-spikes-and-rebalance-for-x-ads
description: >-
When X cost per goal jumps, breaks the change down into what you pay per click, how many people click and how many convert, and fixes the real cause.
---
# Investigate cost spikes and rebalance for X Ads
Source: https://www.roadwayai.com/workflows/investigate-cac-spikes-and-rebalance-for-x-ads
From the Workflow Automation Library by Roadway.
## Before you use this outside Roadway
This SKILL.md is a starting point. It needs adjusting before it will work outside Roadway.
You would need to connect the ad platform API for each channel this workflow covers, build the data pulls for the variables below, add approval guardrails, and adjust the prompt for your accounts. If the prompt names an MCP tool, you also need that MCP connected.
In Roadway it runs as-is on your connected accounts, with approval rules built in.
## What it does
When X cost per goal jumps, breaks the change down into what you pay per click, how many people click and how many convert, and fixes the real cause.
When X cost per goal jumps, breaks the change down into what you pay per click, how many people click and how many convert, and fixes the real cause. It checks your live account on a schedule and flags anything that looks off before it costs you much. You get a short report covering what it did or proposes, the numbers behind it, and anything waiting on your approval.
## Steps
1. Collect the inputs listed under Variables. In Roadway they come from your connected accounts. Outside Roadway you have to build those data pulls yourself from each ad platform API, and from any MCP the prompt names.
2. Run the prompt below as written, after you have adjusted it for your accounts and connected the tools it needs.
3. Review the result. Apply changes to a live ad account only after you approve them. Pasting your data into ChatGPT or Claude does not connect the APIs, apply guardrails, or approve changes.
## Variables
auto_approve, cost_per_goal_baseline, funnel_metrics, goal_metric, max_change_pct, monthly_budget_cap, task_history
## Prompt
Investigate cost spikes and rebalance for X Ads
Detect any X Ads Manager campaign whose cost per [set this to your own goal metric] over the last 3-7 days has moved over the cost per goal guardrail versus its 28-day average, decompose the change, and decide:
1. Fix root cause
2. Roll back recent change
3. Wait out learning
4. Accept as market change
Context and defaults (use these; don't ask):
- The baseline cost per goal: [set this to your own cost per goal baseline]. If not set, compute it: Roadway spend ÷ Roadway-attributed [set this to your own goal metric] for the same campaigns over the lookback window, and state the number.
- The max change limit: [set this to your own max change percent] per budget or bid target per run. If not set, 20%. It does not apply to experiment traffic splits.
- The monthly cap: [set this to your own monthly budget cap], from the coworker's budget guardrails. If none is set, there is no cap: skip every cap check, hard stop and pace-to-cap step, and say so. Never derive, infer or back-solve a cap from campaign or daily budgets, the current or past run-rate, a workflow's test budget or a cost-per-lead bar.
- Auto-approve: [set this to your own auto approve]. If not set, it's off: list every change as a proposal for approval.
Rules:
- Decompose cost per goal = CPC (or CPM / CTR) / conversion rate. Name which factor moved and by how much, and only then look for a cause.
- CPC or CPM up: competition (the ad library), seasonality, or narrowed targeting. CTR down: frequency and engagement rate decay or new placements. Conversion rate down: landing page or offer change, tracking issues, or lower-intent traffic from expansion.
- Roll back recent change when the spike started within 72 hours of a change in the change history (bids, budgets, targeting, creative or landing pages).
- Wait out learning when the campaign entered the short optimization period (~3-7 days with steady spend) on purpose and the spike is within the expected range.
- Accept as market change when competitors or seasonality explain it. Then update the baseline cost per goal expectations for the period, instead of fighting it.
- Check Roadway's attributed cost per new customer against the platform's reported cost per goal first. If only the platform number spiked, the cause is tracking or attribution, not performance (and vice versa).
- Rebalance while you diagnose: move up to the max change limit of the affected campaign's budget to the channel's campaign where the next dollar works hardest, and restore it once the cause is fixed.
- Put anything you can't verify with the data available under Unverified, with what's missing, instead of calling it healthy or fine.
- Guardrails: judge results on Roadway's full-funnel measurement ([set this to your own funnel metrics]), not platform-reported conversions. Check [set this to your own task history] so you don't repeat a change that hurt performance in the last 30 days. Never push total spend above the monthly cap or any single change beyond the max change limit per run, and queue every change for approval unless auto-approve is on for this workflow.
Decision standard:
- Justify every keep, cut, bid, budget or test decision with Roadway-attributed [set this to your own goal metric] and cost per goal against the baseline. Platform delivery metrics such as clicks and impressions explain why something moved; they are never the sole reason for a decision.
- Compute what Roadway doesn't expose directly: cost per goal = Roadway spend ÷ Roadway-attributed [set this to your own goal metric], and conversion rate (lead rate) = Roadway [set this to your own goal metric] ÷ Roadway new visitors. Don't substitute platform-reported conversions or conversion rates.
- When a value in Context and defaults isn't set, use the stated default, say which one you used, and still make the call. Don't stop to ask.
- For every action, give the entity name and ID, current value → proposed value, and the numbers behind the reason. Write "None" under any empty heading.
- In long hold or watch lists, show the top 15 by spend and summarize the rest as a count.
Give me a report of each with reasoning for each action. Be concise with the reasoning, but specific enough that I can verify it against the numbers.
Report structure:
X cost per goal spike report
Summary:
The campaigns spiking, the decomposition, the root cause, and the fix.
Fix root cause:
- [campaign] - [reason]
Roll back recent change:
- [campaign] - [reason]
Wait out learning:
- [campaign] - [reason]
Accept as market change:
- [campaign] - [reason]
Unverified:
- [campaign] - [what couldn't be checked and why]
## Run it in Roadway
https://www.roadwayai.com/workflows/investigate-cac-spikes-and-rebalance-for-x-ads
When X cost per goal jumps, breaks the change down into what you pay per click, how many people click and how many convert, and fixes the real cause. It checks your live account on a schedule and flags anything that looks off before it costs you much. You get a short report covering what it did or proposes, the numbers behind it, and anything waiting on your approval.