This PPC script will help you count average amount of ads per each campaign. The results will be showed in the script log right away.
When to use it
- quick check for auditing somebody's campaign
- noticing potential fuck up in your own campaign
- quick check of active ads after a campaign/account launch while you wait on approvals
How to use it
To make it work - paste the code, click "Preview" and switch to tab "Logs".
You will see the ad counts right away.
So copy the scriptand give it a try!
function main() {
Logger.log("script is starting to work...");
Logger.log("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ");
var campaigns = AdWordsApp.campaigns().withCondition("Status = ENABLED").get();
while (campaigns.hasNext()) {
var campaign = campaigns.next();
var campaignName = campaign.getName();
var adCountInCampaign = campaign.ads()
.withCondition("AdGroupStatus = ENABLED")
.withCondition("Status = ENABLED")
.withCondition("CombinedApprovalStatus NOT_IN [DISAPPROVED, UNDER_REVIEW]")
.get().totalNumEntities();
var adGroupCountInCampaign = campaign.adGroups().withCondition("Status = ENABLED").get().totalNumEntities();
if (adGroupCountInCampaign == 0) {
Logger.log(" 0 ads on average in " + campaignName + " " )}
else {
var avgAds = adCountInCampaign / adGroupCountInCampaign;
var avgAdsR = Math.round(avgAds);
Logger.log(" " + avgAdsR + " ads on average in " + campaignName + " " );
} }