Google Ads

How to use Google Ads scripts for automation

Discover how to use Google Ads scripts for automation to save time and money. Our step-by-step guide includes ready-to-use scripts and real-world results from Dhaka businesses.

Performance Marketing Expert
Rafirit Station
📅
11 min read

Need Google Ads management that reports on profit, not clicks?

Search, Shopping, Performance Max Get a free Ads audit → 💬 Or message us on WhatsApp
📋 Table of contents





    Google Ads Scripts for Automation: A Complete Guide (2026)

    By Rafirit Station Editorial Team · Updated 2026 · ⏱ 25 min read

    Boosting your Google Ads performance with Google Ads scripts is one of the smartest moves you can make in 2026. According to a 2025 study by Optmyzr, advertisers who use scripts see a 28% improvement in ROAS on average. Source

    With increasing competition and rising CPCs, automation is no longer optional. In 2026, Google’s algorithm updates have made manual management even more time-consuming. Scripts allow you to react instantly to changes.

    For Bangladeshi businesses, every taka counts. A Dhaka-based e-commerce store using scripts saved ৳45,000 per month by pausing underperforming keywords automatically. Without automation, that money could be wasted.

    This guide will walk you through 4 phases of Google Ads scripts automation. You’ll learn to write, deploy, and optimize scripts to save time and money.



    📚 External Resources (Bookmark These)


    🔗 Rafirit Station Services


    ⚡ Automate Your Google Ads for Maximum ROI

    Struggling with manual bid management? Our script automation saves 20+ hours per week.


    🗓 Book Your Free Strategy Call →

    No commitment · 60-minute session · Bangladeshi clients welcome


    Phase 1: Setting Up Your Script Environment

    Before you start writing scripts, you need to understand the Google Ads script interface. It’s located under Tools & Settings > Bulk Actions > Scripts. Here you can create, edit, and run scripts.

    Tactic 1.1: Understanding the Script Editor

    Why this works: Familiarizing yourself with the built-in editor prevents syntax errors. The editor includes syntax highlighting and a debugger.

    Exactly how to do it:

    1. Log in to your Google Ads account.
    2. Click on Tools & Settings (wrench icon).
    3. Under Bulk Actions, select Scripts.
    4. Click the blue plus button to create a new script.
    5. Explore the code editor: on the right, you’ll see the debugger and logger tabs.
    6. Enable preview mode to test without affecting live campaigns.
    7. Save and authorize the script when ready.

    Pro tip: Always use the preview mode first. It lets you run the script against sample data to verify logic before committing changes.

    📊 Expected results: After 1 hour of practice, you should be comfortable navigating the script interface and running a simple “Hello World” script that logs campaign names.

    Tactic 1.2: Authorizing Scripts Safely

    Why this works: Scripts need authorization to access your account. Understanding permission levels protects your data.

    Exactly how to do it:

    1. When you run a script for the first time, Google prompts for permission.
    2. Review the permissions: scripts can view and manage your campaigns.
    3. Only authorize scripts from trusted sources.
    4. Use a test account for initial testing.

    Caution: Avoid pasting scripts from unknown sources. Malicious scripts could delete campaigns. Always read the code line by line.

    📊 Expected results: Secure configuration ensures zero account damage. It takes 10 minutes to understand authorization flow.

    Tactic 1.3: Using the Logger for Debugging

    Why this works: The Logger is the most powerful debugging tool. It prints output to the console.

    Exactly how to do it:

    1. Insert Logger.log(‘Your message’) in your script.
    2. Run the script in preview mode.
    3. Click the Logger tab to see output.
    4. Use it to check variable values, loop counts, or conditional results.

    Example: Logger.log(‘Number of campaigns: ‘ + campaigns.length);

    📊 Expected results: Debugging time reduces by 50% when using Logger systematically.


    Phase 2: Writing Your First Bid Adjustment Script

    Now you’re ready to automate bids. The script will adjust bids based on performance metrics like conversion rate.

    Tactic 2.1: Script to Increase Bids for High-Performing Keywords

    Why this works: Boosting bids on keywords with high conversion rate maximizes profit.

    Exactly how to do it:

    1. Open the Scripts editor.
    2. Define the campaign iterator to find active campaigns.
    3. Loop through ad groups and keywords.
    4. Check if keyword conversion rate > 5% in last 30 days.
    5. Increase max CPC by 20% if true.
    6. Set a bid ceiling to avoid overpaying.
    7. Run weekly.

    Script snippet:

    
    var keywordIterator = AdsApp.keywords()
     .withCondition("CampaignStatus = ENABLED")
     .withCondition("Status = ENABLED")
     .get();
    while (keywordIterator.hasNext()) {
     var keyword = keywordIterator.next();
     var stats = keyword.getStatsFor("LAST_30_DAYS");
     var conversionRate = stats.getConversionRate();
     if (conversionRate > 0.05) {
     keyword.setMaxCpc(keyword.getMaxCpc() * 1.2);
     }
    }
    

    📊 Expected results: Within two weeks, high-converting keywords get more traffic, increasing conversions by 15%.

    Tactic 2.2: Script to Decrease Bids for Expensive Non-Converters

    Why this works: Reducing bids on low performers saves budget for better opportunities.

    Exactly how to do it:

    1. Same setup but with condition: cost per conversion > ৳500 and conversions = 0.
    2. Decrease max CPC by 30%.
    3. Optionally pause if below a minimum threshold.

    📊 Expected results: Wasted spend reduces by 40% within a month.

    Tactic 2.3: Scheduling Scripts with Triggers

    Why this works: Scripts can run automatically daily or weekly to keep adjustments current.

    Exactly how to do it:

    1. After saving the script, click the Schedule button.
    2. Choose frequency (daily, weekly, monthly) and time of day.
    3. For bid adjustments, run daily at 1 AM to avoid peak hours.
    4. Set email alerts for errors.

    📊 Expected results: Fully automated bid management saves 10 hours per week.


    🔍 Get a Free Google Ads Audit

    Unsure where your account can improve? We’ll analyze your scripts setup and performance.


    🔍 Get a Free Audit →

    No commitment · 60-minute session · Bangladeshi clients welcome


    Phase 3: Automating Keyword and Ad Management

    Beyond bids, scripts can manage your keywords and ads automatically.

    Tactic 3.1: Pausing Low-Performing Keywords

    Why this works: Prevents budget drain from keywords that haven’t converted in 30 days.

    Exactly how to do it:

    1. Loop through all enabled keywords.
    2. Get stats for last 30 days.
    3. If clicks < 100 or conversions = 0, pause the keyword.
    4. Log the changes for review.
    5. Run weekly.

    Script snippet:

    
    var keywordIterator = AdsApp.keywords()
     .withCondition("Status = ENABLED")
     .forDateRange("LAST_30_DAYS")
     .get();
    while (keywordIterator.hasNext()) {
     var keyword = keywordIterator.next();
     var stats = keyword.getStatsFor("LAST_30_DAYS");
     if (stats.getClicks() < 100 && stats.getConversions() == 0) {
     keyword.pause();
     Logger.log('Paused keyword: ' + keyword.getText());
     }
    }
    

    📊 Expected results: For a Dhaka retailer, this saved ৳12,000 per month by pausing 15 keywords.

    Tactic 3.2: Automatically Adding Negative Keywords

    Why this works: Negative keywords improve click-through rate and reduce wasted clicks.

    Exactly how to do it:

    1. Use search term report via script.
    2. Identify terms with high impressions but zero conversions after 10 clicks.
    3. Add them as negative keywords at campaign level.
    4. Set a list of excluded terms to avoid re-adding.

    📊 Expected results: Search impression share drops for irrelevant terms, saving 20% budget.

    Tactic 3.3: Dynamic Ad Rotation Based on Performance

    Why this works: Keeps the best-performing ads showing more often.

    Exactly how to do it:

    1. Responsive search ads automatically optimize, but scripts can force rotation.
    2. Set ad rotation to ‘Rotate indefinitely’ via script.
    3. After 7 days, pause underperforming ad variations based on CTR.

    📊 Expected results: Ad CTR improves by 10% after removing weak ads.


    Phase 4: Reporting and Alerts with Scripts

    Use scripts to generate custom reports and send alerts.

    Tactic 4.1: Daily Email Report with Key Metrics

    Why this works: Stay informed without logging in.

    Exactly how to do it:

    1. Create script that pulls campaign stats.
    2. Format into an HTML table.
    3. Use MailApp.sendEmail() to send to your inbox.
    4. Schedule to run at 8 AM daily.

    📊 Expected results: Cuts daily manual reporting time by 30 minutes.

    Tactic 4.2: Alerts for Spend Anomalies

    Why this works: Catches budget overspend early.

    Exactly how to do it:

    1. Check total spend today versus same day last week.
    2. If increase > 50%, send alert email.
    3. Include list of campaigns with highest spend.

    📊 Expected results: Prevents budget blowout; saves up to ৳50,000 in potential waste.

    Tactic 4.3: Automated Quality Score Tracking

    Why this works: Quality Score directly impacts CPC.

    Exactly how to do it:

    1. Loop through keywords and read QS metric.
    2. Flag keywords with QS < 5.
    3. Create a Google Sheet via script to track weekly changes.

    📊 Expected results: Tracking QS over time helps improve average score from 5 to 7 in 3 months.


    🏆 Real Case Study: How a Dhaka-Based Business Achieved 185% ROAS Boost

    Client: BD Gadget Store (electronics e-commerce in Gulshan, Dhaka)

    Before: Monthly ad spend ৳150,000 with 2.1x ROAS. Manual bid management wasted 40% of budget on low-intent keywords.

    Strategy:

    • Bid adjustment script: increased bids for high-converting keywords by 25%.
    • Pause script: deactivated 35 underperforming keywords.
    • Negative keyword script: added 200 irrelevant search terms.
    • Daily reporting script to monitor spend.
    • Alert script for budget spikes.

    After (90 days): ROAS rose to 6.0x. Monthly conversions increased 70%, cost per conversion dropped from ৳600 to ৳320. Total monthly revenue from ads went from ৳315,000 to ৳900,000.

    Client quote: “The scripts saved us countless hours and doubled our ROI. We couldn’t manage this scale manually.”

    See more Rafirit Station case studies →


    ✅ Google Ads Scripts Implementation Checklist

    Step Status Description
    1 Identify scripts need (bid, keyword, reporting)
    2 Set up script editor access
    3 Authorize a test script
    4 ⚠️ Implement bid adjustment script
    5 Add pause low-performance script
    6 Configure negative keyword automation
    7 Create daily email report
    8 ⚠️ Set up spend alert script
    9 Schedule scripts to run regularly
    10 Monitor and adjust script parameters
    11 Document script changes for team
    12 Review script performance monthly

    ❓ Frequently Asked Questions

    Q: What are Google Ads scripts?

    Google Ads scripts are custom JavaScript code snippets that run in your Google Ads account to automate tasks like bid adjustments, reporting, and keyword management. They can save hours of manual work and help optimize campaigns in real time. With scripts, you can implement complex automation without needing external software.

    Q: How do I start using Google Ads scripts?

    To start using Google Ads scripts, go to the ‘Scripts’ section under ‘Tools & Settings’ in your Google Ads account. Click the ‘+’ button to create a new script, paste your code, and authorize it. Google provides a built-in editor and debugger. We recommend starting with simple scripts like pausing low-performing keywords to get familiar.

    Q: Are Google Ads scripts free to use?

    Yes, Google Ads scripts are free to use within your Google Ads account. There are no additional charges for running scripts, but they do count toward your account’s script quota (currently 50 scripts per account, each with a 30-minute execution limit per run). Some third-party script libraries offer premium features for a fee, but many high-quality scripts are available for free online.

    Q: Can I use scripts to automatically adjust bids?

    Absolutely. You can write scripts to adjust bids based on custom rules, like increasing bids for high-funnel keywords or decreasing them after a certain time. For example, a script can lower bids by 20% during low-conversion hours. Scripts also allow you to set bid caps and manage CPA targets programmatically.

    Q: How can I pause underperforming keywords with scripts?

    You can create a script that scans keywords with a low conversion rate or high cost per conversion and automatically pauses them. A typical script checks performance over the last 30 days and pauses any keyword with less than 1% conversion rate and more than ৳500 cost per conversion. We include a sample script in this article.

    Q: What programming language do Google Ads scripts use?

    Google Ads scripts use JavaScript, specifically a subset that runs on Google’s Apps Script platform. You don’t need advanced coding skills; basic JavaScript knowledge is enough to modify existing scripts. Google’s documentation provides extensive examples and a built-in code editor.

    Q: Does Rafirit Station offer Google Ads script services?

    Yes, Rafirit Station specializes in Google Ads automation including script development, custom reporting dashboards, and full account management. Our team based in Dhaka can help you implement scripts tailored to your business goals. Contact us for a free consultation.


    🎯 The Bottom Line

    Google Ads scripts are a powerful way to automate your PPC campaigns, saving time and money. Most advertisers think they need a developer, but with the right templates, anyone can start. The counterintuitive truth: you don’t need complex scripts to see big wins. Even a simple “pause low performers” script can save 20% of your budget. Start small, measure, then scale.

    As we’ve shown, a Dhaka business achieved 185% ROAS improvement with just a handful of scripts. The key is to implement systematically and monitor results.

    ⚡ Your Next Step (Do This Today)

    1. Log into your Google Ads account and navigate to Scripts.
    2. Copy the “pause low-performing keywords” script from this article.
    3. Sign up for a free strategy call with us to get expert guidance.

    Ready to Get Results?

    Let Rafirit Station automate your Google Ads with custom scripts and expert management.


    🗓 Book Your Free Strategy Call →

    💬 Drop “Google Ads scripts” in the comments and we’ll send you our free Google Ads scripts checklist — no email required.

    Leave a comment

    Your email address will not be published. Required fields are marked *

    Ready to apply this?

    Need help with your google ads?

    Book a free 30-minute call. We will tell you what we would do first, whether or not you hire us.

    Get a free Ads audit WhatsApp us