How to write Google Ads scripts with AI when you don't code
A PPC lead's guide to getting Claude or ChatGPT to write Google Ads scripts, with Google's own limits, a brief template, three worked script ideas and a testing ladder that keeps the account safe.

Google Ads scripts are small JavaScript programs that run inside your Google Ads account on a schedule, reading data, sending alerts and making changes. As of November 2026 you no longer need to write the JavaScript yourself: an AI assistant such as Claude or ChatGPT drafts it from a plain description, and your job becomes specifying, testing and supervising it.
A campaign quietly spends double its budget over a weekend, or a search term report full of junk sits unread for three weeks, and someone says "there's a script for that". There usually is, but it's five years old and nobody can tell what it does. Getting scripts like that written, tested and understood with AI is work Scalewell takes on with PPC leads, so the team gets its alerts without waiting on a developer.
This guide is for the head of paid media or the PPC lead who wants scripts without hiring a developer. It covers what scripts can and cannot do according to Google's documentation, how to brief an AI so the draft is usable, three script ideas worked through in words, and a testing ladder that keeps an AI-written script from making a mess of a live account.
Google Ads scripts are JavaScript that runs inside your account
Google Ads scripts let you manage and query Google Ads data with modern JavaScript, in a browser-based editor, with no servers to run. Google's product overview says the platform "lets you programmatically manage and query your Google Ads data using modern JavaScript (ES6+)" and lists three jobs: automate routine account management, generate custom reports, and connect Google Ads with external data sources.
Underneath, a script talks to the same Google Ads API that enterprise software uses, but Google's overview says scripts run "without provisioning servers or managing developer credentials" and "handle authorization automatically in the browser", and they default to the most recent API version Google supports, per the AdsApp reference. The point for you is that scripts age with the API. A tutorial script from 2021 may call fields that no longer exist, which is one reason the AI route beats copying old code off a forum.
Scripts live under Tools, then Bulk actions, then Scripts in the account. Google's help page walks through the sequence: press the plus button, name the script, paste the code, authorize it when prompted and grant access, then use Preview or Run script now. Each account can hold up to 250 authorized scripts according to Google's limits page, which is more than any team needs.
The limits decide what a script can be asked to do
A script in a single Google Ads account stops after 30 minutes, and most of the other limits follow from that. Google's limits page states that advertiser-account scripts "can execute for a maximum of 30 minutes, after which they will be cancelled", and the table collects the rest of what it says.
| Limit | Value stated by Google | What it means for your brief |
|---|---|---|
| Run time, single account | 30 minutes per run | Big accounts need the script to work in batches or on narrower date ranges |
Run time, manager account with executeInParallel | 60 minutes, up to 50 accounts | One script can cover a whole agency book, in parallel |
| Iterator results | 50,000 by default | Keyword-level scripts on large accounts need filters, not full scans |
| Logging | Truncated at 100Kb | Write results to a sheet, not to the log |
| Authorized scripts per account | 250 | Not a practical ceiling |
| Email recipients per day (Apps Script quota) | 100 for consumer accounts, 1,500 for Google Workspace accounts | One daily summary email, never one email per campaign |
| URL Fetch calls per day (Apps Script quota) | 20,000 for consumer accounts, 100,000 for Workspace | A link checker on 30,000 URLs needs to spread its work over days |
The email and URL fetch rows come from the Apps Script quotas page, which Google's limits page points to for the underlying services. Scheduling has its own ceiling. The help page says you can schedule a script "to run once, daily, weekly or monthly at a certain hour", and the shortest interval is hourly, because the product overview lists "automated hourly, daily, weekly, or monthly scheduling". Nils Rooijmans, a longtime Google Ads scripts specialist, puts it plainly: scripts "cannot be scheduled to run multiple times per hour". So a script is the wrong tool for anything that must react within minutes.
One more limit shows up in practice rather than in the documentation. Andrew Lolk of Savvy Revenue spent two hours trying to get an AI to script portfolio bid strategy changes before concluding "You can't make changes to bid portfolio strategies through a script; it requires the API." The AI kept proposing small fixes rather than saying the task was impossible, which is what you should expect whenever you ask for something the platform does not support.
Preview mode protects your campaigns but still sends the email
Preview runs the script and reports what it would have changed without changing anything in the account. Google's preview documentation states that "No objects are created, deleted, or modified during preview", and that is the reason every guide tells you to preview first.
But preview is narrower than most people assume. The same page says preview "only affects calls that use AdsApp as an entry point". If the script sends an email through MailApp, Google says "it will get sent whether or not the script had been previewed or executed", and "Spreadsheets will get updated in both scenarios as well." Preview a script that emails your CFO a pacing alert and your CFO gets the email.
So treat preview as a dry run for account changes only, and put a switch in the code for everything else. Google exposes one: AdsApp.getExecutionInfo().isPreview() returns true during a preview, per the ExecutionInfo reference. Ask the AI to write every script so that in preview it logs what it would send or write instead of doing it. Here is the shape of that guard, which you can paste into your brief:
function main() {
const preview = AdsApp.getExecutionInfo().isPreview();
const changes = [];
// read data, push each proposed change into changes, build the email text here
if (preview) {
Logger.log("Preview: " + changes.length + " changes and 1 email would have gone out.");
return;
}
// apply changes, write the sheet, send the email
}
A good brief does most of the work
The quality of an AI-written script is decided before the AI writes a line, in the description you give it. The practitioners quoted in this article say the same thing in different words. Lolk's second step is headed "Do not ask the AI to write the script yet"; he has the AI write a plan and list its questions first. Chris Evans at Seer Interactive, writing in October 2023 with no coding background, got a working spellcheck script out of GPT-4 by describing the older script it should replace and then iterating. The one place the model led him wrong was the Microsoft API it pointed him to, which returned authentication errors until he found the right one: "Proceed with caution: this was the main area where GPT drove me the wrong way."
Here is the brief we'd use. Fill every field, paste it whole into Claude or ChatGPT, and keep it with the script so the next person knows what it was for.
Write a Google Ads script (current Google Ads scripts runtime, ES6 JavaScript, AdsApp).
Goal: [one sentence: what should be true after the script runs]
Scope: [which campaigns, ad groups or keywords; include a label or name filter so I can test on one campaign first]
Data to read: [metrics and date range, e.g. cost and conversions for LAST_14_DAYS]
Decision rule: [the exact threshold, e.g. flag campaigns whose month-to-date cost exceeds the daily budget times the number of days elapsed by more than 20%]
Action: [report only / apply a label / make a change. Start with report only.]
Output: [a Google Sheet at this URL, tab named by date / one summary email to this address]
Safety: use AdsApp.getExecutionInfo().isPreview() so that in preview the script logs what it would send or change and sends and changes nothing. Never change more than [N] entities in one run. Log every entity touched, with the before and after values.
Limits to respect: 30-minute run time, so read with filters, not a full account scan.
Before writing code, list your questions and tell me anything in this brief that Google Ads scripts cannot do.
What comes back is a plan and a list of questions, and the script waits until you have dealt with both. Answer every question in plain words, even the obvious ones, because an unanswered question turns into a guess in the code. Then read the plan against the limits table above and against your own account, because the plan is where the AI's assumptions show. Lolk's search terms script was not pulling all the search terms, and the cause was visible in the plan, a filter for the Search channel only: "It was doing exactly what it was told, but it couldn't see the bigger picture."
If the AI says part of the brief cannot be done in a script, take it at its word and move that part to the API or drop it. If it says everything is possible, check the action against the limits section yourself, because the AI on Lolk's portfolio bid task kept insisting it was possible "with just one more small change". When the plan reads right, reply with "write it" for a report-only script. For a script that reads data, decides and changes something, ask for one piece at a time, as Lolk suggests: "Great, let's start with the part that fetches the data."
Two habits make the rounds that follow shorter. Give the AI a working script to adapt when you have one: Stewart Dunlop, CEO of PPC.io, who says "I don't (and cannot) write any code", recommends starting from "a working script that does something similar, then ask AI to modify it", and reports that paste-the-error-back loops usually take two or three rounds. And when fixes start breaking each other, open a fresh chat with the brief and the latest script.

Three scripts worth asking for first
The best first scripts read data and tell a human what they found, because a wrong report costs you a minute and a wrong bid change costs you budget. Here are three Google Ads scripts examples we'd ask an AI for, described in the words you would put in the brief.
A daily pacing alert that compares spend with budget
Ask for a script that runs daily around 07:00, reads yesterday's cost and month-to-date cost for every enabled campaign, compares each with the campaign's daily budget amount, and sends one summary email listing campaigns that spent more than twice their daily budget yesterday or are more than 20 percent ahead of a straight-line month. Google states that a campaign "might spend up to twice your average daily budget" on a given day and "no more than 30.4 times your average daily budget" in a month, per its spending limits page, so twice the daily budget is the edge of what Google itself calls normal, and anything above it deserves a look. The script needs getStatsFor("YESTERDAY"), the campaign's getBudget().getAmount() and MailApp, and it changes nothing in the account. Tell the AI to skip campaigns on a total budget rather than a daily one, because Google's Budget reference says getAmount() returns zero for those and the comparison would divide by zero. The full pacing method, including what to do when the alert fires, is in our guide to automating PPC budget pacing checks.
A weekly search term sweep into a Google Sheet
Ask for a script that runs weekly, queries the search term view for the last 30 days, keeps terms with at least 10 clicks and zero conversions, and writes them to a dated tab in a Google Sheet with campaign, ad group, clicks, cost and the term, then emails the sheet link. Google's reports documentation shows exactly this kind of query against search_term_view with segments.date DURING LAST_30_DAYS, and the exportToSheet() method writes the result straight to a spreadsheet. The decision about what becomes a negative keyword stays with a person, because Charles Bannister's warning that poor negatives can be worse than none is quoted in Lunio's scripts round-up for good reason. If you want the AI to do the first read of that sheet too, our weekly negative keyword review with AI covers it.
A monthly cap that labels first and pauses later
Ask for a script that runs hourly, reads month-to-date cost per campaign, and when a campaign passes a monthly cap you keep in a settings sheet, applies a label named Over cap YYYY-MM and emails you. Only after a month of watching the labels land correctly do you ask the AI for version two, which pauses the labeled campaign using pause() and records the before and after state in a log tab. Google's Campaign reference confirms pause(), getBudget() and applyLabel(), with the note that label names are case-sensitive, which is the kind of detail that makes a draft fail on its first live run.
Google has already written two more worth adapting rather than inventing: the Account Anomaly Detector, which compares today's impressions, clicks, conversions and cost with the same weekday over the previous 26 weeks by default, and the Link Checker, which fetches every final URL with UrlFetchApp and tracks its progress across runs so large accounts fit inside the time limit. Reading Google's solution code with the AI beside you is the fastest way to learn what good looks like.
Test an AI-written script in four stages
An AI-written script goes live only after it has passed preview, a manual run on one campaign, and a week of scheduled report-only runs, in that order. The stages exist because the failure stories are consistent. Matthew Umbro, writing for Practical Ecommerce in March 2025, got a working target CPA alert from Claude after one fix, then watched a no-impressions script default to the wrong time period, treat ended experiments as live campaigns, and produce new errors with each replacement. His summary: "Claude's script for tCPA conflicts worked. The no-impressions script did not."
- Preview with a narrow scope. Run Preview with the scope filter set to one test campaign. Read the log, check that the counts match what the interface shows for the same date range, and remember that emails and sheet writes still happen in preview unless the
isPreview()guard is in place. - Run once by hand on the same scope. Use Run script now and watch the Logs section. Open the sheet or email and check three rows against the account. Lolk's advice on scope applies: "Don't waste five or eight minutes on every test run by pulling data from an entire MCC for the last year."
- Schedule it report-only for a week. Widen the scope to the whole account but keep the action at report or label. Each morning, compare what the script flagged with what you would have flagged, and fix one thing per round. As Lolk puts it, "The critical rule here is to fix one thing at a time."
- Promote the action, with a cap. Only now ask the AI for the version that changes something, with a hard cap on entities per run and a log of before and after values. Lolk's arithmetic is worth keeping in mind: a plus 20 percent change followed by a minus 20 percent change leaves a $100 value at $96, so bid-changing scripts that run repeatedly drift unless they work from a stored baseline.
| Stage | Action level | What you check | Time it takes |
|---|---|---|---|
| 1. Preview | None, AdsApp calls are not applied | Log counts match the interface for one campaign | 15 minutes |
| 2. Manual run | Report or label on one campaign | Three rows of output against the account | 30 minutes |
| 3. Scheduled, report-only | Report or label on the whole account | Daily comparison with your own judgment | One week |
| 4. Live | Change, capped and logged | Before and after values in the log tab | Ongoing, weekly review |
AI-written scripts fail by doing what you said, not what you meant
AI-written scripts fail most often by doing exactly what you said rather than what you meant. Lolk's search terms script pulled only the Search channel type because that is what it was told to do, and missed the rest. Umbro's script treated ended experiments as live campaigns because nobody told it they existed. On Optmyzr's PPC Town Hall in August 2026, Frederick Vallaeys summed up Nils Rooijmans' view of AI agents as "interns with terrifying confidence", and the line fits an AI writing scripts just as well.
There are also cases where you should not script at all. Lolk advises against scripts when you manage only one or two small accounts, for one-time questions, and for automated changes without human review, and we agree with all three. A one-time question is faster to answer through a direct AI connection to the account, so if that is the shape of your need, connecting Claude or ChatGPT to Google Ads through an MCP server is a better fit than a scheduled script. And if a script keeps surfacing the same problem, that is an audit finding rather than an automation job, which our guide to running a PPC audit with AI covers.
On evidence, none of the published write-ups we found reports an error rate or a controlled time saving for AI-written scripts. Lolk estimates his idea-to-working-script time fell by 90 to 99 percent, Dunlop says two to three rounds per script, and Umbro gave up on one of two scripts. Those are three people's accounts rather than a benchmark.
You will know it worked when the script is boring
A script has worked when, three months on, nobody talks about it. The pacing alert fires twice a month and both times it is right, the search term sheet appears every Monday and somebody adds ten negatives from it, and hours that went on pulling the same report now go on the decisions the report was for. Keep the brief, the final script and a one-paragraph note of what it does together in one place, dated. When Google changes something and the script breaks, which it will, the next person pastes all three plus the error into a fresh chat and starts from stage one again.
Where to start this week
Pick the pacing alert, fill in the brief, and run it through the four stages this week; a report-only script is the lowest-risk way to learn how your account and an AI behave together. If you'd like help setting up the method for your team, Scalewell builds this kind of AI-assisted workflow around how a paid media team already works.
Frequently asked questions
Do I need to know JavaScript to use Google Ads scripts?
You do not need to know JavaScript. As of November 2026 an AI assistant can draft a working script from a plain description, and people with no coding background have published accounts of doing exactly that. You do need to read logs, check output against the account, and describe what you want precisely, and those skills matter more than syntax.
Can an AI-written script damage my account?
An AI-written script can damage your account if it changes bids, budgets or statuses and you skip testing. Preview mode makes no changes to campaign data, so a script that only reads and reports is close to harmless. Risk starts when you promote it to make changes, so cap the changes per run and log before and after values.
Is there a limit to how often a Google Ads script runs?
There is a limit: the shortest schedule is hourly, and Google's help page lists once, daily, weekly and monthly options at a set hour. A single-account script also stops after 30 minutes per run. Anything that needs to react within minutes is a job for the Google Ads API or a rule inside the platform, not a script.
Should I use a script or an MCP connection to my Google Ads account?
Use a script for anything that should happen on a schedule without a person present, such as a daily alert or a weekly sheet. Use an MCP connection when a person is asking questions of the account in a chat session. Many teams end up with both: scripts for the routine, a chat connection for the investigation.
Can a Google Ads script call ChatGPT or Claude while it runs?
A script can call a language model, because scripts reach external APIs through UrlFetchApp, and practitioners have published scripts that send search terms to a model and write scores to a sheet. Each call counts against the Apps Script daily URL fetch quota and costs tokens, so filter the data in the script first and only send what needs judgment.