Script to Count Ads | Part 1 of 3

ppc script to count ads - ppc automation, goole ads

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.

The result will look like this

So copy the script
and 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 + " " );

  }  }

Logger.log("-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ");
Logger.log("script is finished");

}

Part 2 and 3 will contain options for
πŸ’–MCC report and πŸ’–impression weighted detailed report.

       

If you enjoyed this article please share it

You can also thank me by buying me a cup of coffee or following me on twitter.
My self-esteem needs more worshipers.

or even join our PPC team!

Leave a Reply

Your email address will not be published. Required fields are marked *