Skrypt Google Ads: Limited Status Finder

Jedną z przyczyn spadku wyników na kontach Google Ads może być ograniczenie wyświetlania reklam. Zdarza się, że algorytm zmieni wybranym reklamom status na Zatwierdzona (ograniczona).
To z kolei może zupełnie zablokować ich wyświetlanie.

Niestety Google nie informuje o takich działaniach.

Przygotowałem skrypt, który sprawdza wszystkie konta na wskazanym MCC i szuka reklam ze statusem oznaczonym jako ograniczony.
Lokalizacja znalezionych reklam zostanie wysłana na wskazany przez nas adres e-mail.

Link do dokumentacji w tej sprawie:
https://support.google.com/google-ads/answer/2684542?hl=pl

Uwagi: jest to skrypt w wersji MCK (nie zadziała na pojedynczym koncie)
Harmonogram: raz dziennie
Konfiguracja: wprowadź swój e-mail do zmiennej EMAIL


Po więcej na temat Skryptów zapraszam na grupę FB o automatyzacji:
https://www.facebook.com/groups/skrypty.google.ads


/*
Copyright 2019 Krzysztof Bycina, www.LiveAds.pl
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

//Configuration
var EMAIL = ['ENTER YOUR EMAIL HERE'];
//End of the configuration


var badAds = [];

function main() {
    validateEmail(EMAIL[0]);
    findBadAds();
    sendEmails();
}

function findBadAds() {
    var accountSelector = AdsManagerApp.accounts();
    var accountIterator = accountSelector.get();
    while (accountIterator.hasNext()) {
        var account = accountIterator.next();
        AdsManagerApp.select(account);
        var ads = AdWordsApp.ads()
            .withCondition("CombinedApprovalStatus = APPROVED_LIMITED")
            .withCondition("Impressions > 0")
            .forDateRange("LAST_30_DAYS")
            .get();
        if (ads.totalNumEntities() > 0) {
            Logger.log(account.getName() + " - has  ads with the Limited Status. Please, check your email for more details.");
            while (ads.hasNext()) {
                var ad = ads.next();
                var adCampaignName = ad.getCampaign();
                var adAdgroupName = ad.getAdGroup();
                badAds.push(account.getName() + "\\" + adCampaignName.getName() + "\\" + adAdgroupName.getName() + ' has ads with the Limited Status.');
            }
        } else {
            Logger.log(account.getName() + " - doesn't have ads with the Limited Status.");
        }
    }
}


function validateEmail(email) {
    var key = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    if (key.test(email) === false) {
        throw new Error('You must enter a valid email address to run the script!')
    }
}

function sendEmails() {
    if (badAds[0]) {
        MailApp.sendEmail(EMAIL.join(','), 'You have ads with the Limited Status.',
            'Hi, \n\nPlease, check these ads: \n\n' + badAds.join("\n"));
    }
}

3 comments / Add your comment below

  1. Hej, skrypt pokazuje mi ogranoczone reklamy w kampanaich które nie są już aktywne.
    Czy da się ustawić skrypt tak aby wysyłał komunikat tylko w przypadku kampanii aktywnych?

Dodaj komentarz

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *