What this script does
This script monitors how your Performance Max campaigns spend across four channels:
Search
Shopping
Display
Video
It looks at two timeframes:
A short rolling period, by default the last 7 days
A longer baseline period, by default the last 30 days
If the cost share for a channel changes more than your chosen threshold (for example 20 percent), the script flags it and sends you an email with a clear summary per campaign.
What you will see
After you connect the script to a Google Sheet, it will:
Fill a 30 day summary tab with daily metrics per campaign and per channel
Create a 7 day rolling summary tab that smooths out day to day noise
Color code the columns so you can visually scan totals and each channel
Auto resize columns so the data is easy to read
This makes it simple to see, for each PMax campaign:
How much you spent per channel
How impressions, clicks, and conversions are divided across channels
How this mix is changing over time
How alerts work
The script checks for meaningful shifts in channel distribution per campaign, focused on cost.
For each campaign it:
Compares the latest rolling period with the longer baseline
Looks at the share of cost per channel instead of just absolute spend
Ignores tiny volumes so you are not flooded with noise
Triggers an alert only when the change is bigger than your configured threshold
When changes are detected you receive an email that includes:
A summary of how many changes were found
How many campaigns and which channels are affected
A campaign by campaign breakdown, including direction and size of the shift
A link to the Google Sheet for deeper analysis
What you can configure
Inside the script settings you can adjust:
Which Google Sheet it writes to
How big a change should be before you get an alert
The minimum number of impressions before a campaign is considered
How many days to use for the total analysis period
How many days to use for the rolling average
Which email addresses should receive alerts
You can tune these settings to match your account size and how often you want to be notified.
When to use this script
Use this script if you:
Rely on Performance Max and want control over where the budget actually goes
Need early warning when PMax shifts spend from Search to Display or Video or vice versa
Want a clean, ready to use data export for deeper analysis in Sheets or Data Studio
Prefer a simple email summary instead of manually checking reports
It is especially useful for agencies and in house teams that manage multiple PMax campaigns and do not want to manually inspect channel distribution every week.
Practical tips
Start with a higher threshold like 20 percent to avoid too many alerts, then lower it if needed
Check the spreadsheet regularly to spot slow trends that might not trigger an alert yet
Use the 7 day tab to see recent changes and the 30 day tab for context
Combine this with your normal performance reviews to decide if you should adjust assets, feeds, or budgets
