MCC script finding Location Exclusion option (presence vs presence or interest)

254 views
Skip to first unread message

lea.h...@commissionsinc.com

unread,
Dec 30, 2020, 1:15:32 PM12/30/20
to Google Ads Scripts Forum
Hello,
We have some accounts where we selected "Presence or interest" for excluded geographic locations parameters and we feel this might be depressing traffic.

Is there a way in Google scripts to report whether a campaign's excluded locations are based on Presence (recommended) or "Presence or interest"? We want to identify all campaigns that are using "Presence or interest" in Geographic Exclusions and change that setting to Presence. 

From Google Ads UI under campaign location options:

Exclude: 

Presence: People in your excluded locations (recommended)
Presence or interest: People in, regularly in, or who've shown interest in your excluded locations

Looking around in developers.google.com I didn't see anything when searching "Presence or interest" but saw "PlacesofInterest" here https://developers.google.com/adwords/api/docs/appendix/reports/criteria-performance-report#systemservingstatus:
 Function function = new Function(); function.setLhsOperand(Arrays.asList( (Operand) new PlacesOfInterestOperand(PlacesOfInterestOperand.Category.AIRPORT)); function.setOperator(Operator.AND); function.setRhsOperand(Arrays.asList( (Operand) new GeoTargetOperand(Lists.newArrayList(new CriterionId(2250L))));  


Thank you!

lea.h...@commissionsinc.com

unread,
Dec 30, 2020, 2:18:41 PM12/30/20
to Google Ads Scripts Forum
Would I need to report on negativeGeoTargetType = DONT_CARE  ? 
https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService.GeoTargetTypeSetting#negativegeotargettype
I think we'd want to change GeoTargetTypeSetting.NegativeGeoTargetType from DONT_CARE to LOCATION_OF_PRESENCE

negativeGeoTargetType

GeoTargetTypeSetting.Negati...

The setting used for negative geotargeting in this particular campaign.

The campaign can be negatively targeted using both Physical Location and Location of Interest, or only based on where the user is located. Negative targeting triggers ads for all users except those whose location is related to the given locations.

The default value is DONT_CARE.

EnumerationsDONT_CARE Specifies that a user is excluded from seeing the ad if they are in, or show interest in, advertiser's targeted locations.LOCATION_OF_PRESENCE Specifies that a user is excluded from seeing the ad if they are in advertiser's targeted locations.  

lea.h...@commissionsinc.com

unread,
Dec 30, 2020, 2:39:48 PM12/30/20
to Google Ads Scripts Forum
I've tried these options but none are working (undefined)
 var campaign = campaignIterator.next();
// first try/ failed: 
 var settingsIterator = campaign.targeting().GeoTargetTypeSetting.NegativeGeoTargetType().get();

  // second try /failed :
var settingsIterator = campaign.GeoTargetTypeSetting.NegativeGeoTargetType().get();

// third try / failed:
 var settingsIterator = GeoTargetTypeSetting.NegativeGeoTargetType().get();

// fourth try /failed:
var settingsIterator = campaign.targeting().excludedLocations().GeoTargetTypeSetting.NegativeGeoTargetType().get();

On Wednesday, December 30, 2020 at 1:15:32 PM UTC-5 lea.h...@commissionsinc.com wrote:

Google Ads Scripts Forum Advisor

unread,
Jan 3, 2021, 11:47:04 PM1/3/21
to adwords...@googlegroups.com
Hi there,

Thank you for reaching out to us. Let me do the best I can to assist you in this.

With regard to your concern, we would recommend to utilize Google Ads Scripts Reports which allows you to access the rich collection of AdWords API reports. As per your use case, the values that you mentioned are available under Geo performance reports' locationType field.

Regards,
Google Logo
Teejay Wennie Pimentel
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2AGDGd:ref

lea.h...@commissionsinc.com

unread,
Jan 4, 2021, 9:23:59 AM1/4/21
to Google Ads Scripts Forum
Hi Teejay Wennie,
Do I understand correctly that the Geo performance report's location type will report Excluded geos location type?

Thanks!

lea.h...@commissionsinc.com

unread,
Jan 4, 2021, 9:29:54 AM1/4/21
to Google Ads Scripts Forum
I've never seen a performance report for exclusions, so am still unsure how to use LOCATION_OF_PRESENCE for the excluded geos. Will keep reading the page https://developers.google.com/adwords/api/docs/appendix/reports/geo-performance-report#locationtype and try to figure it out, but just wanted to restate that this is for exclusions.

Google Ads Scripts Forum Advisor

unread,
Jan 4, 2021, 11:47:04 PM1/4/21
to adwords...@googlegroups.com
Hi there,

Yes, the Geo performance report's location type will report Excluded geos location type. You may check the information here for further information regarding this.

lea.h...@commissionsinc.com

unread,
Jan 11, 2021, 6:12:58 PM1/11/21
to Google Ads Scripts Forum
Hi Teejay Winnie,
I tried using LocationType in the GEO_PERFORMANCE_REPORT but have not found a way to report only the Excluded Locations (the areas where I've told the campaign to never serve the ads). The below script seems to be showing areas that received traffic but are not positive target locations. Since the Excluded Locations don't receive any impressions because users associated with those locations are blocked from seeing the report, I'm wondering if the GEO_PERFORMANCE_REPORT is not able to pull excluded locations and the presence or presence or interest setting I'm wanting to report on for our Excluded physical locations. Searching for more info on "LocationType" I came across the Microsoft Ads documentation https://docs.microsoft.com/en-us/advertising/reporting-service/geographicperformancereportcolumn?view=bingads-13 and know they based their scripts closely on Google Ads scripts. They define location type as 'The location type used to deliver ads. For example to distinguish between people in versus searching for or viewing pages about the corresponding location of interest. The possible location type values include "Physical location" and "Location of interest". Physical location indicates that the user was physically located in the corresponding City, Country, MetroArea, or State locations. Location of interest indicates that the physical location of the user was not used to serve the ad, and the user was searching for or viewing pages about the corresponding City, Country, MetroArea, or State locations. If the user is searching for the location that they are in, then the location type is "Physical location". For example if the search user is in Seattle and searching for Seattle, the location type is "Physical location".'

My concern is that if Excluded Locations are blocked, and LocationType is the type of location that was used to deliver ads, there would be no LocationType data for Excluded Locations because the ad was never served to a user. 

Am I misunderstanding still? Is there a qualifier I can add to the below report to pull data only for Exlcuded Locations. All of the rows getting pulled into the report have Impressions > 0, so I don't think the report is pulling data for Excluded Locations like I want it to. Thanks for your continued help!


function main() {
    var accountIterator = MccApp.accounts()
    .forDateRange("THIS_MONTH")
    .orderBy("Clicks DESC").get();
    var spreadsheet = SpreadsheetApp.openById("PASTE_SHEET_ID_HERE_JUST_ID_NOT_FULL_SHEET_URL");
    var mccAccount = AdWordsApp.currentAccount();
    var sheet = spreadsheet.getActiveSheet();
    sheet.appendRow(['CampaignName', 'CustomerDescriptiveName', 'IsTargetingLocation', 'CountryCriteriaId', 'Customer ID', 'LocationType', 'Impressions', 'Clicks', 'Conversions', 'Cost']);
    while (accountIterator.hasNext()) {
        var account = accountIterator.next();
        // Switch to the account you want to process.
      var account_name = account.getName();
      var account_name = account.getName() ? account.getName() : '--';
    Logger.log(account_name);
   MccApp.select(account);
       var query =  AdWordsApp.report(
      "SELECT CampaignName, CustomerDescriptiveName, IsTargetingLocation, CountryCriteriaId, ExternalCustomerId, LocationType, Impressions, Clicks, Conversions, Cost FROM GEO_PERFORMANCE_REPORT " +
         "WHERE IsTargetingLocation = FALSE " +
      "DURING LAST_30_DAYS ");

      var result = query.rows();

while (result.hasNext()) {
var row = result.next();
   
   sheet.appendRow([row['CampaignName'], row['CustomerDescriptiveName'], row['IsTargetingLocation'], row['CountryCriteriaId'], row['ExternalCustomerId'], row['LocationType'], row['Impressions'], row['Clicks'], row['Conversions'], row['Cost']]);
      
      
  }
}
}

Google Ads Scripts Forum Advisor

unread,
Jan 12, 2021, 3:41:27 AM1/12/21
to adwords...@googlegroups.com
Hi there,

Thank you for getting back to us. I've discussed this to the rest of the team to get their insight, and they mentioned that your use case is possible though Google Ads script's search which you can use to fetch both structural and metric data about resources in your account. Once implemented, you need to use the campaign resources. The negative_geo_target_type contains the LOCATION_OF_PRESENCE for the excluded geos.

lea.h...@commissionsinc.com

unread,
Jan 12, 2021, 10:25:28 AM1/12/21
to Google Ads Scripts Forum
Thank you Teejay Wennie and Team!
I'll try those suggestions. 
Also, I had a typo in my previous message - correcting that below for anyone who reads the thread in the future. The typo was "users associated with those locations are blocked from seeing the reports" and I meant to write "users associated with those locations are blocked from seeing the ads"

Since the Excluded Locations don't receive any impressions because users associated with those locations are blocked from seeing the ads, I'm wondering if the GEO_PERFORMANCE_REPORT is not able to pull excluded locations and the presence or presence or interest setting I'm wanting to report on for our Excluded physical locations.   

Best,
Lea

lea.h...@commissionsinc.com

unread,
Jan 21, 2021, 7:53:18 PM1/21/21
to Google Ads Scripts Forum
Hi Teejay Wennie and Team,

Here's the script - thanks again for your guidance.

function main() {
  
   var accountIterator = MccApp.accounts()
   .withCondition("Clicks > 0")
    .forDateRange("THIS_MONTH")
    .orderBy("Clicks DESC").get();
    var spreadsheet = SpreadsheetApp.openById("INSERT_YOUR_SHEET_ID");
   
// in your spreadsheet - name a sheet ExclusionSetting or change that name below
  var mccAccount = AdWordsApp.currentAccount();
    var sheet = spreadsheet.getSheetByName('ExclusionSetting');
   
    sheet.appendRow(['CampaignID']);
    while (accountIterator.hasNext()) {
        var account = accountIterator.next();
        // Switch to the account you want to process.
      var account_name = account.getName();
      var account_name = account.getName() ? account.getName() : '--';
 
   MccApp.select(account);
   
      var campaignIterator = AdsApp.campaigns()
  .withCondition("Status = ENABLED")
     .get();
  
  while (campaignIterator.hasNext()) {
  var campaign = campaignIterator.next();
 
         var query = 'SELECT campaign.id FROM campaign ' +
      'WHERE segments.date DURING THIS_MONTH AND campaign.geo_target_type_setting.negative_geo_target_type = "PRESENCE_OR_INTEREST"';

    var result = AdsApp.search(query);
while (result.hasNext()) {
  var row = result.next();
 
  Logger.log(row);
  sheet.appendRow([row]);
}
}
    }
}


Google Ads Scripts Forum Advisor

unread,
Jan 21, 2021, 9:37:36 PM1/21/21
to adwords...@googlegroups.com
Hi there,

Thank you for providing your feedback, and I'm glad that you were able to achieve your desired report.

Please let me know if you have further concerns related to Google Ads Scripts. We'll be happy to assist you.
Reply all
Reply to author
Forward
0 new messages