Are you managing PMax Campaigns using Product Feeds in your Google Ads Account? Then, this script is tailored just for you!
It addresses a tricky issue that arises with PMax campaigns. What is it, you ask? Unlike Smart Shopping Campaigns, Performance Max Asset Groups always display your ads, regardless of whether they contain products or not. As this seemed illogical to me, I devised a solution by writing a script for your Google Ads account.
This script efficiently pauses and activates your PMax Asset Groups based on a single factor: whether they contain products from your product catalogue (e.g., product feed) or not. It operates entirely automatically and primarily performs the following steps:
- Gathers all your products and categorizes them based on your specified criteria into a spreadsheet.
- Logs all your asset groups along with their respective item listings in a separate section of the spreadsheet.
- Creates two new parts in the spreadsheet: one for including products and another for excluding them. It calculates the number of products assigned to each asset group (whether excluding or including).
- Generates a final section with a straightforward table featuring three columns: Campaign Name, Asset Group Name, and Status (active/paused). The status depends on whether an Asset Group has products linked to it or not.
- Retrieves this final table and activates or pauses Asset Groups in your account based on this condition – whether it contains products or not.
And now, here are the steps you need to follow when you want to run it:
- Accept the fair use agreement by clicking the button placed at the bottom of this page.
- Copy the template Google Sheet and give it a name that will help you identify which account it is associated with.
- Copy the Script Code, create a new Script in your Google Ads account, name it „Uncle SEM’s Asset Group Status Handler,“ and then paste the script code.
- Copy the URL of your Google Spreadsheet and paste it into the script where it says „ENTER YOUR SPREADSHEET URL HERE.“
- Finally, save and authorize the script.
- Test the script, and if everything runs smoothly (please read the disclaimer below), set it to run daily at your preferred time.
That’s it!
Disclaimer:
Before running it, I would recommend testing the script in a preview mode. This will allow it to complete a run, showing you what WOULD happen, without actually changing the status of any asset group. You can review the results of this test in the „Logs“ and „Changes Protocol.“
Verify that only the correct asset groups are being activated and paused. Due to the various ways you can set up and structure your Account, there may be scenarios I haven’t accounted for when creating this script. As I’m continually working on improving it, please don’t hesitate to reach out to me on LinkedIn if you encounter any issues. As long as it’s feasible to fix, I’m willing to give it a try.
Important Note:
Please ensure that your account structure meets the following criteria: Do you have excluding Item Listings in your Pmax Asset Groups, aside from those labeled „exclude everything else“? If yes, please continue reading; if not, you are already good to go.
If you answered „yes“ to the question above, please review the following and consider making some minor adjustments to your structure. If you’re excluding specific products from your Asset Group, these exclusions must share the same Item Listings as the inclusions. Otherwise, the script won’t be able to generate accurate information when calculating the number of products linked to your asset groups. Allow me to clarify using a simple example from an account I manage in Sweden:
Let’s say, in this Asset Group, I aim to advertise all „Tablet PCs“ that aren’t „iPads“ and also segment the Group into a performance category labeled „over-index.“ If you would organize your listing group like this, the script would not function propper:
What’s happening here?

- You selected all „tablet pcs“ (surfplattor in swedish).
- Then you exclude only „iPads“ and include „all other products.“
- Next, you apply the label (in my case „over-index“) only to the last included Item listing.
- The issue arises because the script wouldn’t recognize that it should only exclude iPads labeled „over-index“ in this case. Consequently, the calculated number would be inaccurate, potentially leading to an incorrect status for this asset group (active/paused).
The solution looks now like this:

- You need to select the label first and then proceed from there. The key difference now is that only iPads labeled „over-index“ are excluded, rather than all iPads.
- Now the script will calculate everything accurately.
- Typically, such situations are quite rare, and you might not even encounter one in your account. However, please be mindful of this possibility.
- If the script incorrectly pauses or activates one or more Asset Groups in your account, check the listing groups associated with those Asset Groups. It’s likely due to the setup described above. When you adjust it as shown in this example, everything will run smoothly.
Fair use Agreement
By accepting, you agree to the following:
- You are permitted to use this script in your Google Ads Account(s), whether you are operating the account privately, acting as an agency for a client, or managing it directly as an employee of a company. This permission extends to all users.
- I cannot guarantee that this script will always function flawlessly in your account. Please remember to periodically verify that only Asset Groups containing products are activated, and Asset Groups without active products are paused, as this is the intended function of the script. However, by using this script you acknowledge that you are full responsible for its output yourself.
- You are not allowed to generate any profits from this script, such as selling it under your name to others, aswell as you are not allowed to claim ownership of this script.