---
type: "article"
title: "Stop guessing what works in your Google Ads campaigns"
summary: "Fellow PPC marketers 👋\nEver felt like you’re shooting in the dark with your campaigns? You tweak a bid here, add a keyword there, and cross your fingers hoping for a performance boost.\nI’m a PPC specialist for a B2B SaaS company. Two people managing 30+ Google campaigns across three regions (AMER, APAC, EUROPE).\nThe problem isn’t making changes. It’s remembering what you changed and whether it actually worked.\nGoogle Ads shows you changes in the performance chart, but you can’t export them alongside your metrics. I used to track everything in a spreadsheet, but that meant hours of tab-switching just to remember what I did before I could start actual optimization work.\nSo I built a solution using Claude. A Google Ads script that automatically catches every account change and waits 14 days to capture the performance impact.\nTL;DR: Scroll down for the script and GitHub repo.\n\n\n\nThanks for reading ProductChimp! Subscribe for free to receive new posts.\n\n\n\n\n\n\nWhat I needed\nA system that would:\n\nAutomatically detect account modifications (bids, budgets, keywords, audiences)\n\nRecord these changes systematically\n\nCapture performance metrics before changes occurred\n\nWait 14 days for statistical significance\n\nRecord post-change performance metrics\n\nEnable objective comparison (with Sheet’s GPT integration)\n\nAt its core, it’s a Google Ads Query script through API calls.\nI tested different models. GPT-4o gave mixed results, mostly errors. Grok with DeepSearch and Think mode was inconsistent. Claude worked perfectly on the first try.\nPrerequisites\nYou’ll need:\n\nGoogle Cloud Project with the Google Ads API enabled\n\nDeveloper Token for the Google Ads API (Standard Access, not Basic Access)\n\nOAuth authentication configured with appropriate scopes\n\nGoogle Sheet structured with specific monitoring worksheets\n\nGoogle Apps Script environment for code execution\n\nHow it works\nAuthentication and API access\nFirst, create reliable access to the Google Ads API through OAuth authentication:\nfunction refreshAccessToken() {\n  const url = ‘https://accounts.google.com/o/oauth2/token’;\n  const payload = {\n    client_id: CONFIG.CLIENT_ID,\n    client_secret: CONFIG.CLIENT_SECRET,\n    refresh_token: CONFIG.REFRESH_TOKEN,\n    grant_type: ‘refresh_token’\n  };\n  // Execution logic...\n}\n\nOne critical insight: use Script Properties to store sensitive credentials rather than hardcoding them. Easy to overlook, but essential for security.\nChange detection system\nThe script uses the Change Event API with this syntax:\nfunction checkBidBudgetChanges() {\n  const now = new Date();\n  const past = new Date(now.getTime() - 24 * 60 * 60 * 1000);\n  \n  const startDatetime = Utilities.formatDate(past, ‘America/Los_Angeles’, “yyyy-MM-dd HH:mm:ss”);\n  const endDatetime = Utilities.formatDate(now, ‘America/Los_Angeles’, “yyyy-MM-dd HH:mm:ss”);\n  \n  const query = `\n    SELECT \n      change_event.change_date_time,\n      change_event.campaign,\n      // Additional fields...\n    FROM change_event\n    WHERE change_event.change_date_time BETWEEN ‘${startDatetime}’ AND ‘${endDatetime}’\n      AND change_event.change_resource_type IN (\n        ‘CAMPAIGN_BUDGET’, \n        ‘AD_GROUP_BID_MODIFIER’, \n        // Additional types...\n      )\n    LIMIT 10000\n  `;\n  \n  // Processing logic...\n}\n\nThis query detects different change types across campaign and ad group levels. I hit errors during implementation (API limitations, incorrect query parameters, result handling issues), but after multiple iterations, it worked.\nReference: Google Ads Query Language Grammar documentation for details.\nPerformance impact measurement\nThe real value comes from measuring change impact systematically:\nfunction checkFourteenDayUpdates(budgetSheet, audienceSheet, ignoreSheet, ignoreMap) {\n  ignoreMap.forEach((entry, changeEventId) => {\n    const daysSince = (new Date() - entry.date) / (1000 * 60 * 60 * 24);\n    \n    if (daysSince >= 14) {\n      // Retrieve and record comparative metrics...\n    }\n  });\n}\n\nThis framework enables objective, data-driven assessment of how specific changes affected key performance indicators over a meaningful time period.\nAutomated analysis\nThe final enhancement introduced automated analysis of performance shifts:\nconst formula = `=GPT(”Analyze the data in this row which contains metrics before and after a budget change. Provide insights on how the change impacted these metrics over 14 days. Be concise, informative, and action-oriented.”,${rowRange},0,standard,false)`;\n\nThis integration transforms raw performance data into actionable insights, reducing analytical burden and accelerating decision-making.\nWhat it looks like\n\n\n\n\n\n\n\n\n\n\nWith the help of Claude (and a lot of trial and errors), I managed to build an MVP. The final product looks something like this..\nWith Claude’s help (and lots of trial and error), I built an MVP. The final product automatically generates analysis that used to take me hours of manual work.\nReal impact\nAfter a budget increase in a primary campaign, the system automatically recorded the change and baseline metrics. Two weeks later, it populated comparison data showing an 8% CTR improvement but a 7% CPC increase. The automated analysis noted: “Budget expansion improved overall conversion volume by 12% while maintaining CPA, suggesting successful scale without efficiency loss.”\nNo more guessing. No more spreadsheet archaeology. Just clear data on what worked and what didn’t.\nWhat I learned\nThis experience changed my perspective on technical barriers in marketing analytics. Claude’s ability to generate working code from clear requirements is remarkable. You don’t need to be a developer. You need to clearly articulate what you want and what outcome you’re looking for.\nFor PPC specialists facing similar analytical challenges, this script offers a pathway to developing customized solutions that enhance decision-making and operational efficiency.\nLink to my GitHub repo: https://github.com/areus-scorpius/google-ads-api-script\n\n\nI'm interested in hearing about other technical solutions you've developed for PPC management challenges. What automation gaps have you identified in your workflow?\nLeave a comment"
newsletter: "Prod_Chimp"
newsletter_handle: "prod-chimp"
newsletter_url: "https://usecommune.com/n/prod-chimp"
author: "Joseph Nguyen (Joseph) (@gbaohnguyen)"
published: "2025-04-09T08:21:49.000Z"
canonical_url: "https://usecommune.com/n/prod-chimp/a/stop-guessing-what-works-in-your-google-ads-campaigns"
markdown_url: "https://usecommune.com/n/prod-chimp/a/stop-guessing-what-works-in-your-google-ads-campaigns.md"
chat_url: "https://usecommune.com/n/prod-chimp/a/stop-guessing-what-works-in-your-google-ads-campaigns/chat"
source_url: "https://productchimpanzee.substack.com/p/google-ads-script-track-changes-measure-impact"
body_source: "imported"
likes: 0
replies: 0
body_words: 863
---

# Stop guessing what works in your Google Ads campaigns

*Fellow PPC marketers 👋*

Ever felt like you’re shooting in the dark with your campaigns? You tweak a bid here, add a keyword there, and cross your fingers hoping for a performance boost.

I’m a PPC specialist for a B2B SaaS company. Two people managing 30+ Google campaigns across three regions (AMER, APAC, EUROPE).

The problem isn’t making changes. It’s remembering what you changed and whether it actually worked.

Google Ads shows you changes in the performance chart, but you can’t export them alongside your metrics. I used to track everything in a spreadsheet, but that meant hours of tab-switching just to remember what I did before I could start actual optimization work.

So I built a solution using Claude. A Google Ads script that automatically catches every account change and waits 14 days to capture the performance impact.

**TL;DR:** Scroll down for the script and GitHub repo.

***

Thanks for reading ProductChimp! Subscribe for free to receive new posts.

***

## What I needed

A system that would:

1. Automatically detect account modifications (bids, budgets, keywords, audiences)
2. Record these changes systematically
3. Capture performance metrics before changes occurred
4. Wait 14 days for statistical significance
5. Record post-change performance metrics
6. Enable objective comparison (with Sheet’s GPT integration)

At its core, it’s a Google Ads Query script through API calls.

I tested different models. GPT-4o gave mixed results, mostly errors. Grok with DeepSearch and Think mode was inconsistent. Claude worked perfectly on the first try.

## Prerequisites

You’ll need:

- **Google Cloud Project** with the Google Ads API enabled
- **Developer Token** for the Google Ads API (Standard Access, not Basic Access)
- **OAuth authentication** configured with appropriate scopes
- **Google Sheet** structured with specific monitoring worksheets
- **Google Apps Script** environment for code execution

## How it works

### Authentication and API access

First, create reliable access to the Google Ads API through OAuth authentication:

```
function refreshAccessToken() {
  const url = ‘https://accounts.google.com/o/oauth2/token’;
  const payload = {
    client_id: CONFIG.CLIENT_ID,
    client_secret: CONFIG.CLIENT_SECRET,
    refresh_token: CONFIG.REFRESH_TOKEN,
    grant_type: ‘refresh_token’
  };
  // Execution logic...
}
```

One critical insight: use Script Properties to store sensitive credentials rather than hardcoding them. Easy to overlook, but essential for security.

### Change detection system

The script uses the Change Event API with this syntax:

```
function checkBidBudgetChanges() {
  const now = new Date();
  const past = new Date(now.getTime() - 24 * 60 * 60 * 1000);
  
  const startDatetime = Utilities.formatDate(past, ‘America/Los_Angeles’, “yyyy-MM-dd HH:mm:ss”);
  const endDatetime = Utilities.formatDate(now, ‘America/Los_Angeles’, “yyyy-MM-dd HH:mm:ss”);
  
  const query = `
    SELECT 
      change_event.change_date_time,
      change_event.campaign,
      // Additional fields...
    FROM change_event
    WHERE change_event.change_date_time BETWEEN ‘${startDatetime}’ AND ‘${endDatetime}’
      AND change_event.change_resource_type IN (
        ‘CAMPAIGN_BUDGET’, 
        ‘AD_GROUP_BID_MODIFIER’, 
        // Additional types...
      )
    LIMIT 10000
  `;
  
  // Processing logic...
}
```

This query detects different change types across campaign and ad group levels. I hit errors during implementation (API limitations, incorrect query parameters, result handling issues), but after multiple iterations, it worked.

Reference: [Google Ads Query Language Grammar](https://developers.google.com/google-ads/api/docs/query/grammar) documentation for details.

### Performance impact measurement

The real value comes from measuring change impact systematically:

```
function checkFourteenDayUpdates(budgetSheet, audienceSheet, ignoreSheet, ignoreMap) {
  ignoreMap.forEach((entry, changeEventId) => {
    const daysSince = (new Date() - entry.date) / (1000 * 60 * 60 * 24);
    
    if (daysSince >= 14) {
      // Retrieve and record comparative metrics...
    }
  });
}
```

This framework enables objective, data-driven assessment of how specific changes affected key performance indicators over a meaningful time period.

### Automated analysis

The final enhancement introduced automated analysis of performance shifts:

```
const formula = `=GPT(”Analyze the data in this row which contains metrics before and after a budget change. Provide insights on how the change impacted these metrics over 14 days. Be concise, informative, and action-oriented.”,${rowRange},0,standard,false)`;
```

This integration transforms raw performance data into actionable insights, reducing analytical burden and accelerating decision-making.

## What it looks like

[![](https://substackcdn.com/image/fetch/$s_!5POv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff679a619-c8a5-4546-b313-9a8529f3cbfb_2180x1304.png)](https://substackcdn.com/image/fetch/$s_!5POv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff679a619-c8a5-4546-b313-9a8529f3cbfb_2180x1304.png)

*With the help of Claude (and a lot of trial and errors), I managed to build an MVP. The final product looks something like this..*

With Claude’s help (and lots of trial and error), I built an MVP. The final product automatically generates analysis that used to take me hours of manual work.

## Real impact

After a budget increase in a primary campaign, the system automatically recorded the change and baseline metrics. Two weeks later, it populated comparison data showing an 8% CTR improvement but a 7% CPC increase. The automated analysis noted: “Budget expansion improved overall conversion volume by 12% while maintaining CPA, suggesting successful scale without efficiency loss.”

No more guessing. No more spreadsheet archaeology. Just clear data on what worked and what didn’t.

## What I learned

This experience changed my perspective on technical barriers in marketing analytics. Claude’s ability to generate working code from clear requirements is remarkable. You don’t need to be a developer. You need to clearly articulate what you want and what outcome you’re looking for.

For PPC specialists facing similar analytical challenges, this script offers a pathway to developing customized solutions that enhance decision-making and operational efficiency.

**Link to my GitHub repo:** https://github.com/areus-scorpius/google-ads-api-script

***

*I'm interested in hearing about other technical solutions you've developed for PPC management challenges. What automation gaps have you identified in your workflow?*

[Leave a comment](https://productchimpanzee.substack.com/p/google-ads-script-track-changes-measure-impact/comments)

***

## Discussion

No replies yet.
