Script: Auto-Pause Low ROAS Ad Groups on 48-Hour Drops

Learn how to build a custom Google Ads script to auto-pause low ROAS ad groups after 48-hour consecutive performance drops without breaking Smart Bidding.

By AdTurbo Team · 2026-11-27

Running Google Ads without automated safeguards is one of the fastest ways to burn through your media budget. While automated bidding handles baseline auction dynamics, it regularly overspends on decaying ad groups before Smart Bidding registers an efficiency collapse. When a previously profitable ad group suffers an acute performance drop, manual intervention often happens hours or days too late.

Building a custom JavaScript solution inside Google Ads gives you an objective safety net. By deploying a script auto pause low roas ad groups workflow, you protect your bottom line by terminating ad spend on assets that breach critical return thresholds over consecutive windows.

This guide breaks down the operational mathematics of Return on Ad Spend (ROAS) versus Profit on Ad Spend (POAS), provides production-ready code for a 48-hour consecutive drop monitoring script, and details how to safeguard against attribution delays and Smart Bidding disruptions.

---

Why ROAS Fails: The Mathematical Case for POAS Automation

Most performance marketing teams anchor their budget optimization to Return on Ad Spend. While ROAS is easy to calculate, relying strictly on revenue divided by ad spend creates structural blind spots that distort profitability.

ROAS = Gross Revenue / Ad Spend

If you spend $1,000 to generate $4,000 in top-line revenue, your ROAS is 4.0 (or 400%). However, that figure ignores your cost of goods sold (COGS), payment processing fees, shipping expenses, and variable operational overhead. If the underlying product margin is only 20%, that $4,000 in revenue yields $800 in gross margin. You just spent $1,000 to capture $800 of margin, generating a net operating loss of $200 despite a seemingly healthy 400% ROAS.

The Flaw in ROAS Mechanics

The fundamental issue with raw ROAS metrics in script automation lies in product margin variance:

1. Blended Margins Hide Toxic SKUs: A high-volume ad group may maintain an account-wide target ROAS while disproportionately driving low-margin sales that decrease net cash flow.

2. Fixed Cost Inflexibility: When ad platform click prices spike, high ROAS thresholds fail to account for margin compression across fluctuating inventory costs.

3. False Positives in Budget Allocation: An ad group generating a 5.0 ROAS on a 15% margin product is less valuable than an ad group producing a 2.5 ROAS on an 80% margin product.

Defining Profit on Ad Spend (POAS)

To build resilient automation rules, sophisticated advertisers measure Profit on Ad Spend (POAS):

Gross Profit = Gross Revenue - COGS - Transaction Fees

POAS = Gross Profit / Ad Spend

A POAS of 1.0 represents exact break-even on media investment against gross profit. Anything above 1.0 reflects net contribution margin.

| Metric | Definition | Break-Even Point | Considers Margins? | Automation Risk Level |

| :--- | :--- | :--- | :--- | :--- |

| ROAS | Gross Revenue / Ad Spend | Variable (1 / Margin %) | No | High (risks scaling unprofitable revenue) |

| POAS | Gross Profit / Ad Spend | 1.00 | Yes | Low (directly monitors real cash contribution) |

| CPA | Ad Spend / Conversions | Target Margin / Target CPA | No | Medium (ignores order value fluctuations) |

Whether your conversion pipeline pushes raw revenue (ROAS) or calculated profit values (POAS) into Google Ads, the automation logic remains identical: you must identify consecutive periods of underperformance before shutting off spend.

---

Why a 48-Hour Consecutive Trend Matters More Than 1-Day Flukes

Pausing ad groups after a single bad day is one of the most common mistakes in Google Ads automation. Daily conversion volume fluctuates naturally due to weekday consumer habits, server glitches, payment processor timeouts, and conversion tracking delays.

If your script evaluates a simple 24-hour lookback window, it will trigger false alarms. You risk disabling your highest-performing ad groups simply because a Tuesday afternoon experienced an isolated dip in checkout completions.

The Volatility of Single-Day Windows

Consider an ad group that routinely delivers a 3.5 ROAS. On Wednesday, the ad group spends $150 and logs zero conversions. If an automated rule evaluates that 24-hour block in isolation, it calculates a 0.0 ROAS and immediately pauses the asset.

By Thursday morning, delayed conversions from Wednesday's ad interactions process through the system via Google's attribution pipeline, bringing Wednesday's real ROAS up to 2.8. However, because the ad group was paused Wednesday night, the auction loop was severed, killing the momentum of an otherwise healthy asset.

The Structural Logic of 48-Hour Consecutive Decline

To eliminate single-day variance, our script monitors two distinct, consecutive rolling windows:

• Window A (Yesterday / Day -1): Analyzes spend and conversion value from the most recently completed day.

• Window B (Day Before Yesterday / Day -2): Analyzes the performance of the preceding 24-hour block.

An ad group is only flagged for automated pausing when both Window A and Window B independently fail your minimum target threshold (e.g., ROAS < 1.2 or POAS < 0.8), while maintaining a minimum spend filter to guarantee statistical significance. This operational logic mirrors what an experienced media buyer checks when running a manual PPC campaign management check.

Evaluation Loop:

IF (Day -1 Spend MinSpend AND Day -1 ROAS < TargetThreshold)

AND

(Day -2 Spend MinSpend AND Day -2 ROAS < TargetThreshold)

THEN:

Action - Pause Ad Group

Action - Apply Audit Label ('Auto-Paused: Low ROAS')

Action - Dispatch Notification (Email/Logs)

Requiring performance failure across two consecutive periods eliminates up to 85% of false-positive actions caused by temporary attribution delays and transient consumer behavior.

---

Complete Google Ads Script: Auto-Pause on Consecutive ROAS/POAS Drops

The following Google Ads Script uses the modern Google Ads API reporting framework (GoogleAdsService.search). It evaluates ad group performance across two individual 24-hour windows (yesterday and the day before yesterday), checks for statistical significance via spend thresholds, applies a tracking label, and pauses failing ad groups.

javascript

/

• Google Ads Script: Auto-Pause Ad Groups on Consecutive Low ROAS/POAS Drops

• Evaluates ad groups over two individual 24-hour periods (Yesterday & Day Before Yesterday).

• If an ad group breaches the threshold across both consecutive windows, it is paused

• and labeled for post-mortem auditing.

/

var CONFIG = {

// Minimum threshold below which an ad group is considered failing (e.g., 1.5 = 150% ROAS or 1.5 POAS)

ROASTHRESHOLD: 1.20,

// Minimum spend required per single day to evaluate the threshold (avoids pausing on micro-spend)

MINDAILYSPEND: 25.00,

// Label applied to ad groups when paused by this script

AUDITLABEL: 'AutoPausedLowROAS48h',

// Set to true to execute live pauses. Set to false to test execution safely in preview mode

LIVEEXECUTION: false,

// Optional: List of Campaign Name substrings to ignore (e.g., Brand campaigns)

EXCLUDEDCAMPAIGNPATTERNS: ['Brand', 'Competitor', 'Retention'],

// Optional: Notification recipient for execution alerts

NOTIFICATIONEMAIL: '[email protected]'

};

function main() {

Logger.log('Starting 48-Hour Consecutive ROAS/POAS Drop Monitor...');

// Ensure audit label exists in the account

ensureLabelExists(CONFIG.AUDITLABEL);

var dateYesterday = getDateString(1);

var dateDayBefore = getDateString(2);

Logger.log('Analyzing Window A (Yesterday): ' + dateYesterday);

Logger.log('Analyzing Window B (Day Before): ' + dateDayBefore);

var statsYesterday = getDailyStats(dateYesterday);

var statsDayBefore = getDailyStats(dateDayBefore);

var adGroupsToPause = [];

// Evaluate ad groups present in both evaluation blocks

for (var adGroupId in statsYesterday) {

if (statsDayBefore.hasOwnProperty(adGroupId)) {

var dataY = statsYesterday[adGroupId];

var dataDB = statsDayBefore[adGroupId];

// Verify minimum daily spend requirements are met for both days

if (dataY.cost = CONFIG.MINDAILYSPEND && dataDB.cost = CONFIG.MINDAILYSPEND) {

var roasY = dataY.cost 0 ? (dataY.convValue / dataY.cost) : 0;

var roasDB = dataDB.cost 0 ? (dataDB.convValue / dataDB.cost) : 0;

// Check if both windows breach the minimum acceptable efficiency threshold

if (roasY < CONFIG.ROASTHRESHOLD && roasDB < CONFIG.ROASTHRESHOLD) {

adGroupsToPause.push({

id: adGroupId,

name: dataY.name,

campaignName: dataY.campaignName,

roasYesterday: roasY.toFixed(2),

spendYesterday: dataY.cost.toFixed(2),

roasDayBefore: roasDB.toFixed(2),

spendDayBefore: dataDB.cost.toFixed(2)

});

}

}

}

}

Logger.log('Identified ' + adGroupsToPause.length + ' ad groups breaching consecutive thresholds.');

// Execute pauses and apply labels

executeAdGroupActions(adGroupsToPause);

}

function getDailyStats(dateString) {

var stats = {};

var query = 'SELECT adgroup.id, adgroup.name, campaign.name, metrics.costmicros, metrics.conversionsvalue ' +

'FROM adgroup ' +

'WHERE adgroup.status = "ENABLED" ' +

'AND campaign.status = "ENABLED" ' +

'AND segments.date = "' + dateString + '"';

var response = AdsApp.search(query);

while (response.hasNext()) {

var row = response.next();

var campaignName = row.campaign.name;

// Verify campaign exclusions

var isExcluded = false;

for (var i = 0; i < CONFIG.EXCLUDEDCAMPAIGNPATTERNS.length; i++) {

if (campaignName.indexOf(CONFIG.EXCLUDEDCAMPAIGNPATTERNS[i]) !== -1) {

isExcluded = true;

break;

}

}

if (isExcluded) continue;

var cost = row.metrics.costMicros / 1000000;

var convValue = row.metrics.conversionsValue || 0;

stats[row.adGroup.id] = {

id: row.adGroup.id,

name: row.adGroup.name,

campaignName: campaignName,

cost: cost,

convValue: convValue

};

}

return stats;

}

function executeAdGroupActions(failingAdGroups) {

if (failingAdGroups.length === 0) {

Logger.log('Zero ad groups met pause criteria. Execution complete.');

return;

}

var emailAlerts = [];

for (var i = 0; i < failingAdGroups.length; i++) {

var item = failingAdGroups[i];

var adGroupIterator = AdsApp.adGroups().withIds([item.id]).get();

if (adGroupIterator.hasNext()) {

var adGroup = adGroupIterator.next();

var logMessage = 'Target: "' + item.name + '" in Campaign: "' + item.campaignName + '" | ' +

'Day-1: Spend

+ item.spendYesterday + ' (ROAS: ' + item.roasYesterday + ') | ' +

'Day-2: Spend

Google Verified Fully Automated

Get More Leads & Sales From Google Ads — On Autopilot

AdTurbo is your AI Google Ads agent, built by top Google Ads agency owners. AdTurbo works tirelessly in the background managing your Google Ads to get more leads and sales, while you focus on running your business.

Sign up with Google

7-day free trial. No contracts. Cancel anytime.

+ item.spendDayBefore + ' (ROAS: ' + item.roasDayBefore + ')';

if (CONFIG.LIVEEXECUTION) {

adGroup.pause();

adGroup.applyLabel(CONFIG.AUDITLABEL);

Logger.log('[ACTION EXECUTED] Paused: ' + logMessage);

emailAlerts.push('PAUSED: ' + logMessage);

} else {

Logger.log('[DRY RUN ONLY] Would have paused: ' + logMessage);

emailAlerts.push('DRY RUN: ' + logMessage);

}

}

}

if (CONFIG.NOTIFICATIONEMAIL && CONFIG.NOTIFICATIONEMAIL !== '[email protected]') {

var subject = (CONFIG.LIVEEXECUTION ? '[LIVE ACTION] ' : '[DRY RUN] ') +

'Google Ads Script Alert: Low ROAS Ad Groups Paused';

var body = 'The following ad groups met consecutive low-efficiency criteria:\n\n' +

emailAlerts.join('\n');

MailApp.sendEmail(CONFIG.NOTIFICATIONEMAIL, subject, body);

}

}

function ensureLabelExists(labelName) {

var labelIterator = AdsApp.labels().withCondition('Name = "' + labelName + '"').get();

if (!labelIterator.hasNext()) {

Logger.log('Creating audit label: ' + labelName);

AdsApp.createLabel(labelName, 'Flag for ad groups paused automatically due to consecutive low ROAS.');

}

}

function getDateString(daysAgo) {

var targetDate = new Date();

targetDate.setDate(targetDate.getDate() - daysAgo);

var year = targetDate.getFullYear();

var month = ('0' + (targetDate.getMonth() + 1)).slice(-2);

var day = ('0' + targetDate.getDate()).slice(-2);

return year + '-' + month + '-' + day;

}

---

Step-by-Step Implementation & Setup Instructions

Deploying custom automation requires precision. A syntax error or incorrect configuration parameter can pause active campaigns across your entire account. Follow these setup steps to implement the script safely.

Step 1: Access the Scripts Management Interface

1. Sign in to your Google Ads Account.

2. Navigate to the top navigation bar, click on Tools and Settings (wrench icon), and select Scripts under the Bulk Actions column.

3. Click the blue plus button (+) to create a new script project.

Step 2: Paste and Customize the Script Configuration

Delete all default placeholder code inside the text editor and paste the complete script provided above. Adjust the configuration constants at the top of the file:

• ROASTHRESHOLD: Determine your baseline floor. If your margin threshold demands a 2.0x return, input 2.00. If you are tracking direct net profit via custom conversion values (POAS), set this to your minimum floor (such as 1.00).

• MINDAILYSPEND: Ensure this value reflects meaningful data. For example, setting this to $25.00 prevents the script from pausing an ad group that spent $2.50 without generating a conversion.

• EXCLUDEDCAMPAIGNPATTERNS: Add exact string identifiers for brand preservation. Brand name terms and high-intent competitor tests should rarely be paused by broad automated logic. If you bid on rival trademarks, review our operational analysis on whether you can bid on competitor brand keywords in Google Ads.

• LIVEEXECUTION: Keep this set to false during initial deployment.

Step 3: Authorize and Preview

1. Click the Authorize button in the bottom right corner to grant the script access to run GAQL queries and manage campaign entity states.

2. Click the Preview button.

3. Open the Logs tab at the bottom of the editor. Review the output line by line. The console will display each ad group's Day-1 and Day-2 spend, conversion values, and whether it triggered the threshold flag.

Step 4: Schedule Daily Automated Execution

Once you verify that the execution logs accurately identify only genuinely failing assets without touching healthy campaigns, change LIVEEXECUTION: false to LIVEEXECUTION: true and save the script.

1. Return to the main Scripts dashboard.

2. In the script's row, locate the Frequency column.

3. Select Daily and assign an execution time of 03:00 AM or 04:00 AM in your local account timezone. Running the script early in the morning ensures that all spend and initial conversion logs from the preceding day have populated before the script evaluates yesterday's performance.

---

Handling Attribution Lag, Lookback Windows, and Edge Cases

Deploying programmatic rules without accounting for conversion tracking mechanics can harm an otherwise healthy account. When designing logic to auto-pause low ROAS ad groups, you must structure safeguards around attribution delay.

User Clicks Ad ---------- Direct Visit ---------- Return via Organic/Direct ---------- Purchase

(Monday) (No Conversion) (Wednesday) (Conversion Value Applied to Monday)

The Challenge of Conversion Attribution Lag

Conversion attribution lag refers to the time elapsed between an initial ad click and the completed conversion event. In high-ticket eCommerce and B2B lead generation, the path to conversion rarely happens in one session.

If your business has a 3-day average conversion lag, evaluating performance on Day -1 and Day -2 will inevitably undercount final conversion values. To confirm your business's specific timeline:

1. Go to Tools and Settings Measurement Attribution.

2. Open the Path Metrics report and view Days to Conversion.

3. If more than 20% of your conversions occur beyond 48 hours after the initial interaction, a strict 48-hour pause script will register false negatives.

In such cases, modify the script's getDateString() parameters to evaluate Day -3 and Day -4 instead of Day -1 and Day -2. This allows enough time for the bulk of attributed conversion value to populate, as we highlight in our PPC audit checklist.

Diagnosing Root Causes Before Permanent Deactivation

Before deciding whether an ad group should remain permanently deactivated, run a systematic post-mortem on why efficiency dropped:

• Tracking Infrastructure Breaks: Did the Google Tag Manager container fail, or did the checkout confirmation webhook time out? Check your sitewide conversion volume before assuming ad traffic failed.

• Search Intent Dilution: Broad match expansion frequently injects unqualified queries into mature ad groups. Inspect your queries using our search terms report guide to see if irrelevant impressions drained your spend.

• Landing Page Disruptions: Did a recent theme update break payment gateways or introduce 404 errors on landing page variants?

---

Re-enabling Paused Ad Groups: Automated vs. Manual Safeguards

It can be tempting to add an "auto-unpause" function to your script if conversion value increases retroactively or if a new week begins. However, writing auto-enable scripts without human review introduces major operational risks.

The Problem with Auto-Enabling Paused Assets

When a script automatically unpauses an ad group because delayed conversions finally processed, you create an erratic loop:

1. The ad group underperforms across a 48-hour window and gets paused.

2. Spend instantly drops to zero.

3. A delayed purchase attribution processes 48 hours later, raising the historical ROAS above your threshold.

4. An auto-enable script detects the updated ROAS and reactivates the ad group.

5. The ad group re-enters the auction with cold traffic, underperforms again, and gets paused.

This cycle disrupts your bid algorithms, triggers frequent bidding strategy recalculations, and destabilizes budget allocation across the campaign.

Structured Reactivation Protocol

To safely bring paused assets back online, enforce a manual triage protocol:

Asset Paused by Script

│

├── Step 1: Filter ad groups by label 'AutoPausedLowROAS48h'

│

├── Step 2: Review search term hygiene & negative keyword coverage

│

├── Step 3: Check conversion lag attribution adjustments

│

├── Step 4: Resolve underlying asset issues (bids, copy, landing page)

│

└── Step 5: Remove audit label & reactivate manually

1. Filter by Script Label: In the Ad Groups view, filter for Label CONTAINS AutoPausedLowROAS48h.

2. Review Search Term Hygiene: Verify whether junk traffic caused the decline. Add any newly discovered negative keywords before unpausing, or source additional exclusions using our negative keywords examples.

3. Assess Bidding Strategy Learning Impacts: Frequent bid and budget shifts damage campaign stability. Before reactivating, confirm whether adjusting the ad group's target CPA or target ROAS is safer than simply toggling the status back and forth.

4. Audit Landing Page Changes: Verify that pricing, stock levels, and page load speeds are functioning properly.

5. Remove the Audit Label: Once you manually re-enable the ad group, clear the script label so it can be monitored normally in future runs.

---

Script Maintenance, API Limits, and Scaling to Full Automation

While Google Ads Scripts provide a quick, free way to add safety guardrails, they rely on basic infrastructure that requires ongoing maintenance.

Technical Limitations of Google Ads Scripts

• Execution Timeouts: Scripts enforce a strict 30-minute maximum execution window. If your account manages thousands of active ad groups across multiple campaigns, large historical queries can hit this timeout before completing.

• Performance Max Blind Spots: Traditional scripts cannot parse or pause individual asset groups within Performance Max campaigns in the same way they handle search or display ad groups. Performance Max requires dedicated asset-group mutation calls through the raw API.

• Lack of Contextual Intent: Scripts execute simple binary rules. They cannot determine whether poor performance stems from a holiday weekend, an out-of-stock product variant, or intentional split testing by your creative team.

Automation Maturity Curve:

[Manual Review] ── [Google Ads Scripts] ── [API-Connected AI Management Platform]

Low Cost Rule-Based Guardrails Autonomous Bidding & Context Awareness

High Labor Prone to Script Timeouts Full Funnel Budget Protection

Transitioning from Scripts to AI Management

Custom JavaScript rules work well as an immediate patch for wasted ad spend. However, scaling growing enterprise or agency accounts across multiple channels usually requires more than static conditional logic. Modern marketing teams rely on machine learning systems that forecast attribution trends, dynamically reallocate budgets, and handle adjustments automatically.

If you want comprehensive protection without the hassle of maintaining custom code or debugging API updates, using dedicated PPC management software offers significant advantages. An advanced Google Ads automation platform handles real-time conversion adjustments, protects account efficiency across every campaign format—including Performance Max—and prevents attribution-lag mistakes out of the box.

---

Related Guides

• Google Ads Optimization Checklist: 15 Things to Check Every Week

• Why Is Google Ads So Expensive? 7 Reasons (And How to Pay Less)

• PPC Campaign Management: A Complete Guide for 2026

---

Frequently Asked Questions

Can I run this script on Performance Max campaigns?

No, standard Google Ads scripts that reference the adgroup resource cannot pause asset groups inside Performance Max campaigns. Performance Max operates on asset groups rather than standard ad groups, requiring dedicated API mutations or script templates specifically built to alter asset group statuses.

What should I do if an ad group is paused incorrectly due to delayed conversions?

If conversion lag causes an ad group to be paused prematurely, adjust the script's lookback window by changing the date parameters from Day -1 and Day -2 to Day -3 and Day -4. Once adjusted, manually review the paused asset in your account, confirm that delayed conversion values arrived, and remove the audit label before re-enabling it.

Will pausing ad groups with a script reset Smart Bidding learning phases?

Pausing an underperforming ad group does not reset the learning phase of your overall campaign bidding strategy, but it will shift how your budget is allocated to remaining active assets. However, constantly pausing and unpausing the same ad group across short intervals will create data volatility and force Smart Bidding models into prolonged recalibration phases.

Google Verified Fully Automated

Get More Leads & Sales From Google Ads — On Autopilot

AdTurbo is your AI Google Ads agent, built by top Google Ads agency owners. AdTurbo works tirelessly in the background managing your Google Ads to get more leads and sales, while you focus on running your business.

Sign up with Google

7-day free trial. No contracts. Cancel anytime.