Hi Josh,
Thanks for providing further details.
You may try previewing the updated script below. I modified the script so that the filters that have been applied to the campaign selector will carry over to the targeted locations.
function main() {
var enabledCampaigns = AdsApp.campaigns()
.withCondition("Status = ENABLED")
.withCondition("Conversions < 1")
.forDateRange("LAST_30_DAYS").get()
.next();
var locations = enabledCampaigns.targeting()
.targetedLocations()
.withCondition("Impressions > 99")
.forDateRange("LAST_30_DAYS")
.orderBy("Ctr DESC")
.get();
while (locations.hasNext()){
var location = locations.next();
var locationCtr = location.getStatsFor("LAST_30_DAYS").getCtr();
Logger.log(locationCtr);
var campaign = location.getCampaign();
var campaignCtr = campaign.getStatsFor("LAST_30_DAYS").getCtr();
Logger.log(campaignCtr);
var stat = locationCtr / campaignCtr;
location.setBidModifier(stat);
}
}
Let me know how it goes with the modified script.
Regards,
Ejay