Reports based on Location

125 views
Skip to first unread message

Bipasha Roy

unread,
Nov 25, 2024, 12:30:03 AM11/25/24
to Google Ads API and AdWords API Forum
 I am trying to fetch location-based reports from the 'gegoraphic_view' and from campaigns, but the segments are not working, and I am getting an empty response. Is there any other way I can get location-based metrics?
  
let query = `
            SELECT geographic_view.country_criterion_id,
            segments.geo_target_city,
            segments.geo_target_county,
            segments.geo_target_district,
            segments.geo_target_postal_code,
            segments.geo_target_region,
            segments.geo_target_state,
            campaign.name
            FROM campaign
        `;

        if (campaign) {
            query += ` AND campaign.name = '${campaign}'`;
        }

        console.log("GAQL Query:", query);

        // Execute the query
        const response = await customer.query(query);
        console.log(response);

Google Ads API Forum Advisor

unread,
Nov 25, 2024, 3:13:47 AM11/25/24
to roybip...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out to the Google Ads API support team. 

I understand that you are trying to fetch location-based reports. Please note that the query provided by you is invalid as the campaign resource does not have the mentioned segments. The required segments are present in the geographic_view resource. Please find the modified query below:-

SELECT geographic_view.country_criterion_id, segments.geo_target_city, segments.geo_target_county, segments.geo_target_district, segments.geo_target_postal_code, segments.geo_target_region, segments.geo_target_state, campaign.name FROM geographic_view

You can use the search or searchStream methods in making the API calls while retrieving the data. Additionally, you can utilize the Google Ads Query Builder and Query Validator to build and validate the queries for retrieving the data from the Google Ads API.

Feel free to reach out for any further concerns/queries.

This message is in relation to case "ref:!00D1U01174p.!5004Q02vGluX:ref" (ADR-00276668)

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5



Bipasha Roy

unread,
Nov 25, 2024, 4:20:47 AM11/25/24
to Google Ads API and AdWords API Forum
Hi, I have tried the query you provided using the searchStream method, but it's giving me an empty response.
Screenshot (776).png

Google Ads API Forum Advisor

unread,
Nov 25, 2024, 8:18:30 AM11/25/24
to roybip...@gmail.com, adwor...@googlegroups.com
Hi,

Could you please provide the customer ID of your Google Ads account from which you are attempting to retrieve data? To find the equivalent report for geographic_view in the Google Ads UI, navigate to your account and go to Campaigns > Insights and Reports > When and Where Ads Showed > Matched Locations. Could you confirm if you see any data under this path in your account? If yes, I kindly request you to share an uncropped screenshot of the UI (with the customer ID visible) and highlight the fields, segments and metrics you are trying to access via the Google Ads API.

You can send the details via Reply privately to the author option, or direct private reply to this email.

Bipasha Roy

unread,
Nov 25, 2024, 9:10:56 AM11/25/24
to Google Ads API and AdWords API Forum

Thank you for your email. I am able to retrieve data under the path Campaigns > Insights and Reports > When and Where Ads Showed > Matched Locations in the Google Ads UI.

However, my goal is to create a report in my dashboard similar to the path Campaigns > Audience, Keywords, and Content > Location. For this, I need to access segment-wise, location-based data via the Google Ads API.

These are the fields, and segments i am trying to access : 

SELECT geographic_view.country_criterion_id, segments.geo_target_city, segments.geo_target_country, segments.geo_target_district, segments.geo_target_postal_code, segments.geo_target_region, segments.geo_target_state,
campaign.name FROM geographic_view

Screenshot (781).png

Google Ads API Forum Advisor

unread,
Nov 25, 2024, 12:25:07 PM11/25/24
to roybip...@gmail.com, adwor...@googlegroups.com

Hi,

As per provided information, I understand that you are trying to fetch the segment wise location based data via the Google Ads API and you are getting the empty response. Please note that you are using both the geographic_view.country_criterion_id and segments.geo_target_county fields in the same query. These two fields refer to the same country so that you are getting an empty response. I would suggest you remove the segments.geo_target_county field from the query and run the query again.

Please find the below modified query:

SELECT geographic_view.country_criterion_id, segments.geo_target_city, segments.geo_target_district, segments.geo_target_postal_code, segments.geo_target_region, segments.geo_target_state, campaign.name FROM geographic_view

You can use the search or searchStream methods in making the API calls while retrieving the data. Additionally, you can utilize the Google Ads Query Builder and Query Validator to build and validate the queries for retrieving the data from the Google Ads API.

Feel free to reach out for any further concerns/queries.

This message is in relation to case "ref:!00D1U01174p.!5004Q02vGluX:ref" (ADR-00276668)


Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5


 

 



Reply all
Reply to author
Forward
0 new messages