Unlock the full potential of your Google Ads campaigns with the dynamic capabilities of scripts.
Take control of your advertising strategy by leveraging powerful scripts that seamlessly exclude career page viewers and manage to return customer interactions.
Discover the art of precision in campaign optimization, enhancing your ability to tailor ad experiences and achieve maximum impact. Elevate your Google Ads platform experience with these handpicked favorites designed to refine targeting, boost efficiency, and drive meaningful results for your business

Here is one of many examples:

//Exclude audiences from Google ads - Geek-KB - Meni Lavie

function main() {
  // Set the audience name you want to exclude
  var audienceName = "Audience_to_exclude";

  // Get the Google Ads account
  var account = AdsApp.currentAccount();

  // Get all campaigns in the account
  var campaigns = AdsApp.campaigns().get();

  // Iterate through each campaign
  while (campaigns.hasNext()) {
    var campaign = campaigns.next();

    // Exclude the audience from the campaign
    excludeAudienceFromCampaign(campaign, audienceName);
  }
}

// Function to exclude audience from a campaign
function excludeAudienceFromCampaign(campaign, audienceName) {
  // Get the audience criterion to exclude
  var audienceCriterion = getAudienceCriterionByName(audienceName);

  // If the audience criterion exists, exclude it from the campaign
  if (audienceCriterion) {
    campaign.excludeAudience(audienceCriterion);
    Logger.log("Excluded audience '" + audienceName + "' from campaign '" + campaign.getName() + "'.");
  } else {
    Logger.log("Audience '" + audienceName + "' not found.");
  }
}

// Function to get audience criterion by name
function getAudienceCriterionByName(audienceName) {
  var audienceCriterion = null;

  // Get the audience criteria in the account
  var criteria = AdsApp.targeting().audiences().get();

  // Iterate through each criterion
  while (criteria.hasNext()) {
    var criterion = criteria.next();
    var criterionName = criterion.getAudience().getAudienceName();

    // Check if the criterion matches the specified audience name
    if (criterionName === audienceName) {
      audienceCriterion = criterion;
      break;
    }
  }

  return audienceCriterion;
}

Using Google ads scripts can speed up the process when approaching and existing account or auditing it.

Comments

comments