Too High Too Low Bids to skrypt Google Ads, który sprawdza, czy nasze stawki przekraczają ustalone normy.
Zarządzanie kontem reklamowym Google to często manualny proces, w którym łatwo popełnić błąd. Przykładowo nietrudno jest ustawić stawkę 20 zł zamiast 2 zł, co może przełożyć się na niepotrzebny wydatek. Szczególnie jeśli nie zauważymy błędu od razu.
Przygotowany skrypt odczytuje aktualnie ustawione stawki (max. CPC) słów kluczowych oraz produktów. Jeśli znajdzie za wysoką lub za niską wartość, to otrzymamy wiadomość e-mail.
Harmonogram: co godzinę
Konfiguracja:
1. Wstaw swój e-mail do zmiennej EMAILS
2. Podaj maksymalną dopuszczalną stawkę do zmiennej MAX_BID
3. Podaj minimalną dopuszczalną stawkę do zmiennej MIN_BID
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 EMAILS = ['ENTER YOUR EMAIL HERE']; var MIN_BID = 0.4; var MAX_BID = 7; //End of the configuration var badKeywords = []; var badItems = []; function main() { validateEmail(EMAILS[0]); if (isSearchActive()) { findBadKeywords(); } findBadItems(); if (badKeywords || badItems) { Logger.log(badKeywords); Logger.log(badItems); sendEmails(); } } //Find keywords with too high or too low bids function findBadKeywords() { var keywords = AdWordsApp .keywords() .forDateRange('TODAY') .withCondition('Impressions > 0') .get(); while (keywords.hasNext()) { var keyword = keywords.next(); var maxCpc = keyword.bidding().getCpc(); var kwName = keyword.getText(); var kwCampaignName = keyword.getCampaign(); var kwAdgroupName = keyword.getAdGroup(); if (maxCpc < MIN_BID) { badKeywords.push(kwCampaignName.getName() + "\\" + kwAdgroupName.getName() + "\\" + kwName + ' has CPC below the set minimum: ' + maxCpc); } if (maxCpc > MAX_BID) { badKeywords.push(kwCampaignName.getName() + "\\" + kwAdgroupName.getName() + "\\" + kwName + ' has CPC above the set maximum: ' + maxCpc); } } } //Find products with too high or too low bids function findBadItems() { var productGroups = AdWordsApp .productGroups() .forDateRange('TODAY') .withCondition('Impressions > 0') .get(); while (productGroups.hasNext()) { var productGroup = productGroups.next(); var productItemId = productGroup.asItemId(); var itemId = productItemId.getValue(); var maxCpc = productItemId.getMaxCpc(); var itemCampaignName = productGroup.getCampaign(); var itemAdgroupName = productGroup.getAdGroup(); if (itemId && maxCpc) { if (maxCpc < MIN_BID) { badItems.push(itemCampaignName.getName() + "\\" + itemAdgroupName.getName() + "\\" + itemId + " has CPC below the set minimum: " + maxCpc); } if (maxCpc > MAX_BID) { badItems.push(itemCampaignName.getName() + "\\" + itemAdgroupName.getName() + "\\" + itemId + ' has CPC above the set maximum: ' + maxCpc); } } } } function sendEmails() { if (badKeywords[0] && badItems[0]) { MailApp.sendEmail(EMAILS.join(','), AdWordsApp.currentAccount().getName() + " has bids that don't meet your requirements.", 'Hi, \n\nPlease, check these keywords: \n\n' + badKeywords.join("\n") + '\n\nAnd these products: \n\n' + badItems.join("\n")); return; } else if (badItems[0]) { MailApp.sendEmail(EMAILS.join(','), AdWordsApp.currentAccount().getName() + " has bids that don't meet your requirements.", 'Hi, \n\nPlease, check these products: \n\n' + badItems.join("\n")); } else if (badKeywords[0]) { MailApp.sendEmail(EMAILS.join(','), AdWordsApp.currentAccount().getName() + " has bids that don't meet your requirements.", 'Hi, \n\nPlease, check these keywords: \n\n' + badKeywords.join("\n")); } } 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!') } } //Check if there are search campaigns active function isSearchActive() { var searchCampaigns = AdWordsApp .campaigns() .withCondition('AdvertisingChannelType = SEARCH AND Status = ENABLED') .forDateRange('TODAY') .get(); if (searchCampaigns.totalNumEntities() > 0) { var theResult = true; } else { var theResult = false; } var activeSerach = searchCampaigns.totalNumEntities(); Logger.log('This account has: ' + activeSerach + " search campaigns active."); return theResult; }