Disapproved Products in Merchant Center Alert Script

57 views
Skip to first unread message

Rhianna Wyss

unread,
Nov 6, 2024, 1:39:24 PM11/6/24
to Google Ads Scripts Forum
Hello,

I have a script set up in my account to send me an email alert when 1 of 31 listed products gets disapproved in Google Merchant Center (I have these 31 products listed in the script to monitor). The script is running in the account daily, but I am not getting email alerts. Additionally, each run log statement shows the following: "xx of xx products in your account were disapproved - xx%" and the second number (the "out of" total number) always changes - it is never 31 and matching the number of IDs that I have listed in the script to monitor.

Are you able to take a look and let me know if changes need to be made to the script to get those email notifications to come through successfully?

Thanks,
Rhianna

Google Ads Scripts Forum

unread,
Nov 6, 2024, 4:08:26 PM11/6/24
to Google Ads Scripts Forum
Hi Rhianna,

Thank you for reaching out to the Google Ads Scripts support team.

In order to investigate the issue further, kindly provide us with the following details.

  • Google Ads account ID/CID
  • Name of the affected script
  • If you are using any spreadsheet in the script, kindly provide us access to the spreadsheet by referring to this article

You can share the requested details via Reply privately to the author option or a direct private reply to this email.


Thanks,
Google Ads Scripts team

Nils Rooijmans

unread,
Nov 7, 2024, 7:25:31 AM11/7/24
to Google Ads Scripts Forum
Here's a script that might solve your needs:

Hope this helps,

Nils Rooijmans
https://nilsrooijmans.com
See my Google Ads Scripts FAQ to avoid the same mistakes I made: https://nilsrooijmans.com/google-ads-scripts-faq/

Click2 Media

unread,
Nov 7, 2024, 7:48:59 AM11/7/24
to Google Ads Scripts Forum
I hope this message finds you well.

I am working on a script where I need to pause and enable a certain functionality, but I’ve encountered an issue. Both actions (pause and enable) are only executed correctly when the code is run twice. I would like some assistance in resolving this so that both actions work as intended when the script is run just once.

Below is the code for reference:


function pauseAllAdGroupsByCampaignName(campaignName) {
    try {
        // Fetch the campaign by its name
        var campaignIterator = AdsApp.campaigns()
            .withCondition("Name = '" + campaignName + "'")
            .get();

        if (campaignIterator.hasNext()) {
            var campaign = campaignIterator.next();

            // Get all ad groups within the found campaign
            var adGroupIterator = campaign.adGroups().get();

            if (adGroupIterator.hasNext()) {
                Logger.log('Pausing all ad groups in Campaign: "' + campaignName + '"');
               
                // Loop through each ad group and pause it
                while (adGroupIterator.hasNext()) {
                    var adGroup = adGroupIterator.next();
                    var adGroupId = adGroup.getId();
                    Utilities.sleep(60000);

                    // Check if the ad group is enabled before pausing
                    if (adGroup.isEnabled()) {
                        adGroup.pause();
                        Logger.log('Ad Group with ID "' + adGroupId + '" and Name "' + adGroup.getName() + '" has been paused.');
                    } else {
                        Logger.log('Ad Group with ID "' + adGroupId + '" and Name "' + adGroup.getName() + '" is already paused.');
                    }
                }
            } else {
                Logger.log('No ad groups found in Campaign "' + campaignName + '".');
            }
        } else {
            Logger.log('No campaign found with the name: ' + campaignName);
        }
    } catch (e) {
        Logger.log('Error pausing ad groups for Campaign "' + campaignName + '": ' + e.toString());
    }
}

function main() {
    var campaignName = "click2mediaoffer";  // Replace with your campaign name
    pauseAllAdGroupsByCampaignName(campaignName);

}

Could you kindly look into this and provide any recommendations or solutions?

Looking forward to your input.

Google Ads Scripts Forum Advisor

unread,
Nov 7, 2024, 11:39:10 AM11/7/24
to adwords...@googlegroups.com
Hi Rhianna,

@Nils Thank you for your input. 

You may follow Nil's suggestion. If you still face any issue, provide us with the earlier requested details:
  • Google Ads account ID/CID
  • Name of the affected script
  • If you are using any spreadsheet in the script, kindly provide us access to the spreadsheet by referring to this article

You can share the requested details via Reply privately to the author option or a direct private reply to this email.

This message is in relation to case "ref:!00D1U01174p.!5004Q02vGieR:ref" (ADR-00274704)

Thanks,
 
Google Logo Google Ads Scripts Team


Rhianna Wyss

unread,
Nov 8, 2024, 1:47:18 PM11/8/24
to Google Ads Scripts Forum
Thanks all - @Nils, I appreciate you sending this over! I'll give this a try and will reach back out if I'm still having issues.

-Rhianna
Reply all
Reply to author
Forward
0 new messages