Disapproved Extensions Script at MCC Level?

284 views
Skip to first unread message

Jared Carpenter

unread,
May 28, 2020, 12:19:40 PM5/28/20
to Google Ads Scripts Forum
I wanted to know, is there was a script that was available that would run daily at the MCC level and alert you via email that an ad extension has been disapproved? It would be a huge time saver when there are so many accounts to manage. Can anyone help me?

Google Ads Scripts Forum Advisor

unread,
May 28, 2020, 3:11:50 PM5/28/20
to adwords-scripts+apn2wqepggs9cb3r...@googlegroups.com, adwords-scripts+apn2wqepggs9cb3r...@googlegroups.co, adwords...@googlegroups.com
Hi Jared,

Although we do not have the script you described on the developer site, such a script could be created using: For example, you could use the following query to report disapproved extensions:
 
  var report = AdsApp.report(
    ' SELECT FeedItemId, PlaceholderType, ValidationDetails, DisapprovalShortNames' +
    ' FROM PLACEHOLDER_FEED_ITEM_REPORT' +
    ' WHERE Status != REMOVED' +
    ' AND DisapprovalShortNames != ""'
  );

Regards,
Matt
Google Ads Scripts Team

ref:_00D1U1174p._5004Q1zscyC:ref

Jared

unread,
May 28, 2020, 3:57:01 PM5/28/20
to Google Ads Scripts Forum
Thanks for your reply. However, I am unfamiliar with creating my own scripts. I figured that this would be a common problem that people might run into. Is there a way you could provide me with more so that I can use them for my MCC?

Google Ads Scripts Forum Advisor

unread,
May 28, 2020, 4:56:30 PM5/28/20
to adwords-scripts+apn2wqepggs9cb3r...@googlegroups.com, adwords-scripts+apn2wqepggs9cb3r...@googlegroups.co, adwords...@googlegroups.com
Hi Jared,

Unfortunately, this channel does not provide custom script implementations. However, we are happy to field any scripts related questions and assist with any coding roadblocks. There are also numerous third party solutions online that may fit your need. The developer site also provides guides on getting started with scripts.

Jared

unread,
May 29, 2020, 3:24:22 PM5/29/20
to Google Ads Scripts Forum
I came across another post that had a similar issue but i do not think it runs how it is intended when i try to run it on the MCC. 

 
It's the 3rd post from the bottom that has what i'm looking for but doesn't run correctly and doesnt email me of disapproved extensions when I add in all my information like my email, googlesheet id, etc. Is this something you can help with or is this not allowed on this channel?

Google Ads Scripts Forum Advisor

unread,
May 29, 2020, 5:08:48 PM5/29/20
to adwords-scripts+apn2wqepggs9cb3r...@googlegroups.com, adwords-scripts+apn2wqepggs9cb3r...@googlegroups.co, adwords...@googlegroups.com
Hi Jared,

Sure, we can help -- can you provide your CID and the name of the script in your account so we can take a look?

Thanks,

Jared

unread,
Jun 1, 2020, 12:37:00 PM6/1/20
to Google Ads Scripts Forum
Hi Matt, I sent you a PM with the information.

Jared

unread,
Jun 8, 2020, 4:25:07 PM6/8/20
to Google Ads Scripts Forum
I guess I'm going to assume that this is impossible to do?

Google Ads Scripts Forum Advisor

unread,
Jun 8, 2020, 4:47:04 PM6/8/20
to adwords-scripts+apn2wqepggs9cb3r...@googlegroups.com, adwords-scripts+apn2wqepggs9cb3r...@googlegroups.co, adwords...@googlegroups.com
Hi Jared,

Unfortunately, I do not see a private reply. Did you send the private reply using the drop down menu (see the down facing arrow button next to the post's date for the menu)?

Jared

unread,
Jun 8, 2020, 5:05:57 PM6/8/20
to Google Ads Scripts Forum
yes I used that. I'll try to resend again.

Jared

unread,
Jun 8, 2020, 5:17:42 PM6/8/20
to Google Ads Scripts Forum
I resent the private message. Did you get it?


On Monday, June 8, 2020 at 1:47:04 PM UTC-7, adsscriptsforumadvisor wrote:

Google Ads Scripts Forum Advisor

unread,
Jun 8, 2020, 10:04:49 PM6/8/20
to adwords...@googlegroups.com
Hi Jared,

My apologies for back and forth.

However, our team haven't receive any private reply with the details requested by Matt. Could you post the details in the comment section instead so our team can proceed with the investigation?

Regards,
Ejay

Jared

unread,
Jun 9, 2020, 12:14:05 PM6/9/20
to Google Ads Scripts Forum
Sure but what i messaged him about was with my CID and what the script name is that i'm using. Ill just post the script here then.


function main() {
    var today = new Date();
    var beginDate = "20140101";
    var endDate = formatDate(today);
    var accountIterator = AdsManagerApp.accounts().get();

    var spreadsheet = SpreadsheetApp.openById("1Jo8kVHrE_-isAYQTUU7zQPLm6cYLobW_PqnTmD9qQn0");


    var mccAccount = AdsApp.currentAccount();
    var i = 0;

    var disapprovedRows = "";
    var disapprovedRowsCount = 0;


    while (accountIterator.hasNext()) {
        var account = accountIterator.next();
        // Switch to the account you want to process.
        AdsManagerApp.select(account);

       var report = AdsApp.report("Select ValidationDetails, AdGroupName, CampaignName, CampaignStatus, DisapprovalShortNames, PlaceholderType from PLACEHOLDER_FEED_ITEM_REPORT where CampaignStatus = 'ENABLED' during " + beginDate + ", " + endDate);
      
        var sheet = spreadsheet.getActiveSheet();

        //Name sheet by account name
        if (i == 0) {
            spreadsheet.renameActiveSheet("Report " + account.getName());

        } else if (i != 0 && !spreadsheet.getSheetByName("Report " + account.getName())) {
            spreadsheet.insertSheet("Report " + account.getName());
        } else if (i != 0 && spreadsheet.getSheetByName("Report " + account.getName())) {
            spreadsheet.setActiveSheet(spreadsheet.getSheets()[i]);
            sheet = spreadsheet.getActiveSheet();
        }

        var rows = report.rows();
        sheet.appendRow(['ValidationDetails', 'AdGroupName', 'CampaignName', 'CampaignStatus', 'DisapprovalShortNames', 'PlaceholderType']); // append column headers

        while (rows.hasNext()) {
            var row = rows.next();
            var validationDetails = row['ValidationDetails'];
            var adgroupName = row['AdGroupName'];
            var campaignName = row['CampaignName'];
            var campaignStatus = row['CampaignStatus'];
            var reason = row['DisapprovalShortNames'];
            var placeholderType = row['PlaceholderType'];
          
          
            // Appends a new row with data obtained from report
            sheet.appendRow([validationDetails, adgroupName, campaignName, campaignStatus, placeholderType]);

            if (validationDetails == 'Disapproved') { // If a row has Approval Status of 'Disapproved', and increase counter by one
                disapprovedRows += validationDetails + ' | ' + adgroupName + ' | ' + campaignName + ' | ' + campaignStatus + ' | ' + reason + ' | ' + placeholderType + '\n'; // construct email message containing disapproved rows
                disapprovedRowsCount += 1; // counter for disapproved rows
            }

        }

        i++;

        var range = sheet.getRange("A2:G30");
        range.sort(7);
    }


    if (disapprovedRowsCount > 0) { // check if there were rows with disapproved status found before sending email
        MailApp.sendEmail('jlcarpe...@gmail.com',
            'Disapproved Extension Alert',
            'You have ' + disapprovedRowsCount + " rows with Disapproved status, see below \n\n" + disapprovedRows); // change email message based on your requirement
    }

}

function formatDate(dt) {
    var day = dt.getDate();
    day = (day > 9) ? day : "0" + day;
    var month = dt.getMonth() + 1;
    month = (month > 9) ? month : "0" + month;
    var year = dt.getFullYear();
    return "" + year + month + day;

Google Ads Scripts Forum Advisor

unread,
Jun 9, 2020, 3:58:43 PM6/9/20
to adwords-scripts+apn2wqepggs9cb3r...@googlegroups.com, adwords-scripts+apn2wqepggs9cb3r...@googlegroups.co, adwords...@googlegroups.com
Hi Jared,

I would recommend adding a log statement just before the conditional on line ~67, to see if the condition is being met. If it is met, then the script should send an email to your address:
 
    Logger.log(disapprovedRowsCount > 0); //Add this log statement
  
    if (disapprovedRowsCount > 0) { // check if there were rows with disapproved status found before sending email
        MailApp.sendEmail('jlcarpe...@gmail.com',
            'Disapproved Extension Alert',
            'You have ' + disapprovedRowsCount + " rows with Disapproved status, see below \n\n" + disapprovedRows); // change email message based on your requirement
    }


If the log returns true, then the email should be sent. However, if you are still not seeing in email, I would recommend checking your spam folder, and making sure that your email account is allowed to receive emails from the Google Ads login email. 

If the log returns false, then the report given on line 22 does not have any rows for which the validationDetails value is 'Disapproved'. As you can see on the bold line, the disapprovedRowsCount variable is incremented only when there is row that is 'disapproved' (which is also what triggers the email).
            if (validationDetails == 'Disapproved') { // If a row has Approval Status of 'Disapproved', and increase counter by one
                disapprovedRows += validationDetails + ' | ' + adgroupName + ' | ' + campaignName + ' | ' + campaignStatus + ' | ' + reason + ' | ' + placeholderType + '\n'; // construct email message containing disapproved rows
                disapprovedRowsCount += 1; // counter for disapproved rows
            }

Hope this helps. 

Regards,
Matt

Jared

unread,
Jun 9, 2020, 4:53:03 PM6/9/20
to Google Ads Scripts Forum
Thank you. However, my problem is not getting emailed anymore, the problem i'm running into is that I cannot get the right information of which ad extension in which account is being disapproved. I want to pull the right information so i know what to look for when i get notified about a disapproved extension. If it could tell me what the ad extension is in terms of what type and what the extension copy says, that would be ideal.


On Tuesday, June 9, 2020 at 12:58:43 PM UTC-7, adsscriptsforumadvisor wrote:
Hi Jared,

I would recommend adding a log statement just before the conditional on line ~67, to see if the condition is being met. If it is met, then the script should send an email to your address:
 
    Logger.log(disapprovedRowsCount > 0); //Add this log statement
  
    if (disapprovedRowsCount > 0) { // check if there were rows with disapproved status found before sending email
        MailApp.sendEmail('jlcarpenter6...@gmail.com',
            'Disapproved Extension Alert',
            'You have ' + disapprovedRowsCount + " rows with Disapproved status, see below \n\n" + disapprovedRows); // change email message based on your requirement
    }

Google Ads Scripts Forum Advisor

unread,
Jun 9, 2020, 9:58:51 PM6/9/20
to adwords...@googlegroups.com
Hi Jared,

Thank you for providing updates about your concern.

Could you confirm if you also want to see the accounts in the email notification where the specific ad extensions are being disapproved? If this is your concern, then you could try appending the account.getName() to disapprovedRows variable (variable where the details of the disapproved extensions will put and this variable will be set to the body of the email).

The modified line of code will be looked like below:
 disapprovedRows += account.getName() + ' | ' + validationDetails + ' | ' + adgroupName + ' | ' + campaignName + ' | ' + campaignStatus + ' | ' + reason + ' | ' + placeholderType + '\n'; // construct email message containing disapproved rows

Hope this will help. Let me know if you have further questions.

Regards,
Ejay

Jared

unread,
Jun 10, 2020, 12:00:49 PM6/10/20
to Google Ads Scripts Forum
Hi Ejay,

Basically what info i'd want to pull is: Account, Extension, Extension Placeholder type, Extension Approval Status in that order. It would only run on accounts that have campaigns that are not paused or removed.

Google Ads Scripts Forum Advisor

unread,
Jun 10, 2020, 4:29:11 PM6/10/20
to adwords-scripts+apn2wqepggs9cb3r...@googlegroups.com, adwords-scripts+apn2wqepggs9cb3r...@googlegroups.co, adwords...@googlegroups.com
Hi Jared,

Please see my guidance for each of the attributes you listed, 'Account, Extension, Extension Placeholder type, Extension Approval Status':
  • Account: you can use account.getName() as Ejay suggested, or you can use the API report's AccountDescriptiveName attribute
  • Extension: I'm a bit unclear what exactly is meant by extension, since the the extension type will given by PlaceholderType
  • Extension Placeholder type: the placeholder type can be retrieved using PlaceholderType. This will actually be provide an ID, which can be matched using this page. For example, Callouts have a placeholder type ID of 17. This attribute is actually used in the report in the script that you provided.
  • Extension approval status: ValidationDetails can used for this, which is also used in the report from the script.
The script that you provided uses reports. It is also possible to get ad extension data using scripts methods.

Regards,
Matt

Jared

unread,
Jun 10, 2020, 7:43:17 PM6/10/20
to Google Ads Scripts Forum
Hi Matt,

What I meant by extension was the contents of what the extension is such as if it was a call extension it would show the number, or a sitelink extension it would show what the verbiage of the sitelink copy.

Google Ads Scripts Forum Advisor

unread,
Jun 10, 2020, 9:50:39 PM6/10/20
to adwords...@googlegroups.com
Hi Jared,

Thanks for the clarifications.

It appears that you want to get the detailed information of every ad extensions that will be reported, however, this report type couldn't provide this information.

You will need to implement Google Ads scripts methods to retrieve it. You may refer to the following links that will direct to the list of methods that you can use to return the information of ad extensions.
Additionally, you may refer to sample codes here for Ad extensions.

Regards,
Ejay
Message has been deleted

Jared

unread,
Jun 12, 2020, 1:25:08 PM6/12/20
to Google Ads Scripts Forum
So is this something I can pull into the report? This seems like a monstrous task to implement each one into the report. If i just omit having to know what the text/details of the extensions, i think just knowing the account has a disapproved extension will probably be good enough. However, when running the original script that i've been working on, i feel the information that it gives me is not correct. It will say that there is an unverified phone number as the reason for disapproval, but when i check the account with the disapproved extension, it is nowhere to be found. Everything is approved and i see no issues. Why is it giving me information doesn't exist?
Reply all
Reply to author
Forward
0 new messages