Using MostSpecificCriteriaId in Reports

136 views
Skip to first unread message

Christopher Larkin

unread,
Feb 24, 2021, 7:14:17 PM2/24/21
to Google Ads Scripts Forum
Hi - 

I am using the following query and instead of getting the geoID for MostSpecificCriteriaId I'm getting either a zip code or a location name. 

Here's my query:

SELECT CountryCriteriaId, MostSpecificCriteriaId, CampaignName, Impressions, Clicks, Cost, Conversions, CostPerConversion, CampaignStatus FROM GEO_PERFORMANCE_REPORT

 WHERE Cost > 0 and CampaignName CONTAINS "Consolidated" and CampaignName DOES_NOT_CONTAIN "ebook" and CampaignName DOES_NOT_CONTAIN "TrueView" DURING 20210201,20210201

And my code is: 

var report = AdsApp.report(queryText);
logAction('Query executed: ' + queryText);
report.exportToSheet(sheet);

Any thoughts as to why I don't get the geoID like I do if I test the query in AWQL.me? 

Thanks in advance -
Christopher



Google Ads Script MostSpecificCriteriaID Screenshot at Feb 24 18-11-13.png

Nils Rooijmans

unread,
Feb 25, 2021, 7:03:46 AM2/25/21
to Google Ads Scripts Forum
Hi Christopher,

have you tried iterating over the rows from the report and Logging the output?

It would not surprise me if your issue has something to do with Google Sheets.

Hope this helps, 

Nils Rooijmans 
See my Google Ads Scripts FAQ to avoid the same mistakes i made: https://nilsrooijmans.com/google-ads-scripts-faq/

Christopher Larkin

unread,
Feb 25, 2021, 9:25:18 AM2/25/21
to Google Ads Scripts Forum
Hi Nils -

I did that. I confirmed that even pulling the elements from the report record-by-record and field-by-field gives the same data. 

Thanks for your suggestion - I always love seeing your comments! 
Christopher

Christopher Larkin

unread,
Feb 25, 2021, 9:27:37 AM2/25/21
to Google Ads Scripts Forum
Side note for readers: the DOES_NOT_CONTAIN fails as well. While on AWQL.me this does prevent campaigns such as "Ebook Consolidated Geotargeting" from showing in the report, in JavaScript the .Report method contains ebook and TrueView campaigns. I tried both cases just in case the query was case sensitive in GAS. 

Thanks!

Google Ads Scripts Forum Advisor

unread,
Feb 26, 2021, 3:29:05 AM2/26/21
to adwords...@googlegroups.com
Hi Christopher,

For us to assist you further, could you please provide the following details via Reply privately to author option?
  • CID
  • Script Name where the issue is reproducible
In case, you encounter an error when using the mentioned option, you can send the requested information on this email (googleadsscr...@google.com) instead, then let us know here once it has been sent.

Regards,
Google Logo
Teejay Wennie Pimentel
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2DIn6G:ref

Google Ads Scripts Forum Advisor

unread,
Mar 1, 2021, 2:15:41 AM3/1/21
to adwords...@googlegroups.com

Hi Chris,

 

Thanks for providing the requested information. Harry here, teammate of Teejay on the Google Ads Scripts Team. Allow me to assist you this time.

 

Kindly use the DOES_NOT_CONTAIN_IGNORE_CASE operator or change the string you are comparing to with "Ebook" instead. This should quickly fix your query as the names of your campaigns starts with a capital letter.

 

The MostSpecificCriteriaId will return the ID of the most specific Location criterion associated with the impression. In addition, the Google Ads Reports will only return what is associated in your Google Ads account. Our team have no control and visibility as to what attribute, segment and metric values should and will return by the reports. With that said, I would suggest that you reach out to our Google Ads Product Team instead for a wider insight and further assistance in this regard. You may reach out to their team through this link.

 

Let me know if you have questions or other concerns.

 

Thanks,

Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2DIn6G:ref

Sigurd Fabrin

unread,
Mar 1, 2021, 8:44:43 AM3/1/21
to Google Ads Scripts Forum
Hi Harry,

But shouldn't mostspecificcriteriaid return an ID rather than a name?

function main() { 
    var report = AdsApp.report(
    'SELECT ' +
    'CityCriteriaId,CountryCriteriaId,MetroCriteriaId,MostSpecificCriteriaId,RegionCriteriaId ' +
    'FROM GEO_PERFORMANCE_REPORT'
    )
    var rows = report.rows()
  while (rows.hasNext()) {
   Logger.log('CityCriteriaId: '+rows.next().CityCriteriaId) // returns names not IDs 
   Logger.log('CountryCriteriaId: '+rows.next().CountryCriteriaId) // returns names not IDs
   Logger.log('MetroCriteriaId: '+rows.next().MetroCriteriaId) // returns Unspecified
   Logger.log('MostSpecificCriteriaId: '+rows.next().MostSpecificCriteriaId) // returns names not IDs
   Logger.log('RegionCriteriaId: '+rows.next().RegionCriteriaId+'\n*\n') // returns names not IDs
  }
}

Output from the script above in an Austrian account 
Screenshot 2021-03-01 at 14.39.11.png

 sigurd

Christopher Larkin

unread,
Mar 1, 2021, 9:54:09 AM3/1/21
to Google Ads Scripts Forum
Yes Sigurd - I think you're correct. This is clearly a bug in the report, and not the same data returned from API calls outside of Google Ads Scripts. 

Christopher Larkin

unread,
Mar 1, 2021, 9:55:54 AM3/1/21
to Google Ads Scripts Forum
Also Sigurd - here in the US, the MostSpecificCriteriaId returns either a name OR a postal ("zip") code. Interesting because we built our application fully expecting the GeoID to come back, and could have built a zip-code-based solution had we known that was possible. 

Google Ads Scripts Forum Advisor

unread,
Mar 2, 2021, 2:10:00 AM3/2/21
to adwords...@googlegroups.com

Hi Sigurd/Christopher,

 

I am afraid that the concern with MostSpecificCriteriaId not returning an ID is really out of our scope of support. It would best to reach out to our Google Ads Products Team instead as they are more equipped in assisting you further in this regard. I would be happy to assist you with any other Google Ads Scripts related concerns. Just let me know.

Reply all
Reply to author
Forward
0 new messages