Hello,The script name is "Location Bidding Adjuster". The account ID is 199-666-6549.SSince the numbers provide before were from Last 30 days, I changed it to reflect the timeframe 2023/03/15-2023/04/14. The cost for Florida via the script is returned as $2.71. The website shows it, for the same timeframe, as $2.81. See the screenshot attached.
Hi,
Thanks for providing the requested information. I would like to inform you that I had to remove your message as it had contained private information. Kindly refrain from posting messages containing private information as this forum is public, moving forward. Please do scrub any private data when posting information/images here or send it privately using the Reply privately to author option or through our provided email alias in our previous response. We are hoping for your kind understanding on this.
I've observed that the query being used by the script you provided is conforming to the AdWords Query Language. I would suggest using a query conforming to the Google Ads Query Language, as the AWQL is already deprecated and is expected to not work as intended. That being said, if you'd like to retrieve data from the targeted locations of campaigns via reporting, I would suggest making use of the report type location_view as well as it's query builder in order to help you build your query. Kindly note that the filters you've set in the UI must match that of your query, such as the date range, in order to retrieve the exact same data in your report. As per the screenshot you've provided, you may instead make use of the field LAST_30_DAYS from the date range drop down and use segments.date DURING LAST_30_DAYS within your query for it to match. If you're following the Custom date you've set (from your screenshot), then your script must also use that date range instead of LAST_30_DAYS or the returned values would not match.
I've made use of the query below in order to retrieve information on the location `Florida, United States` and can confirm that it matches that which can be found in the UI:
Let us know if you have any further clarifications.
Reference links:
Best regards, Google Ads Scripts Team
Hi,
Thanks for providing more information to this. Please see my insights below:
SELECT campaign_criterion.location.geo_target_constant, location_view.resource_name, campaign.advertising_channel_type, campaign.name, metrics.cost_micros, metrics.conversions_value, metrics.conversions FROM location_view WHERE campaign_criterion.location.geo_target_constant = 'geoTargetConstants/21142' AND campaign.advertising_channel_type = 'SHOPPING' AND campaign.name = 'Top - Desktop' AND segments.date DURING LAST_30_DAYS
You may send these privately via the Reply to author option. Note that you may need to join the Google Group for you to use this option. If this option is not available on your end still, you may send it through our email (googleadsscr...@google.com) instead.
Best regards,
![]() |
Google Ads Scripts Team |
Hi,
Thank you for providing the requested information and confirming which view you have retrieved data from.
A different report type would be needed to get the specific data you're looking for as different data would be returned by the location when it is being narrowed down or not. On getting reports for the screenshots you've provided, you would need to use the report type geographic_view as that report can be segmented by the settings you've picked such as: States and Counties. The equivalent fields to use for segmenting are segments.geo_target_state and segments.geo_target_county which you would need to include in the WHERE clause. Please refer to the sample query below in order to get the clicks, conversions and cost (micros) for `Florida, United States` when narrowed down by States as in the UI:
var query = "SELECT campaign.name, geographic_view.country_criterion_id, geographic_view.resource_name, segments.geo_target_state, metrics.clicks, " + "metrics.conversions, metrics.cost_micros FROM geographic_view " + "WHERE segments.date DURING LAST_30_DAYS AND campaign.name = 'Top - Desktop' AND segments.geo_target_state = 'geoTargetConstants/21142'";
In order to retrieve the criterion_id for a specific location, you can create a report using the location_view report type and select the fields campaign_criterion.location.geo_target_constant and location_view.resource_name to check which geo target constant and criterion_id the location corresponds to; as the resource name returns a value in the following format: customers/{customer_id}/locationViews/{campaign_id}~{criterion_id}. That being said, kindly make sure that the filters you've set in the UI match your query so as to obtain the same results.
Let us know if you have any clarifications or if we can assist you with anything else.
Reference links: