Inconsistent Targeting Data for Ad Group Criteria - Keywords Returning Null for Location, Age, and Gender

47 views
Skip to first unread message

Hero Team

unread,
Sep 25, 2024, 9:08:54 AM9/25/24
to Google Ads API and AdWords API Forum

Hello Google Ads API team,

I’m encountering an issue when querying the ad group criteria for my campaigns, where certain fields are consistently returning null values, particularly for location, age_range, and gender. However, I am getting results for keywords, which seems to cause confusion with the other targeting fields.

I’m using the following query to retrieve targeting criteria for a specific campaign:

SELECT
  ad_group_criterion.type,
  ad_group_criterion.negative,
  ad_group_criterion.location.geo_target_constant,
  ad_group_criterion.age_range.type,
  ad_group_criterion.gender.type,
  ad_group_criterion.device.type,
  ad_group_criterion.language.language_constant,
  ad_group_criterion.resource_name
FROM ad_group_criterion
WHERE campaign.id = ${campaignId}

While this query runs successfully, it returns rows where the location, age_range, and gender fields are null, but I am getting keywords (exactly 10 results for 10 keywords in this ad group). Based on this, I’m led to believe that:

  1. Keywords are treated as part of the ad group criteria.
  2. Since keywords do not use fields like location, age_range, or gender, those fields naturally return null for those rows.
What I’m Trying to Understand:
  1. Are keywords and targeting data (e.g., location, age_range, gender) stored in the same structure as ad group criteria?
    My results suggest that keywords and other targeting criteria like location, age, and gender share the same resource (ad_group_criterion), but I’d like clarification on whether this is intended behavior.

  2. Why are non-relevant fields (like location, age, and gender) returning null for keyword targeting?
    Is it expected for those fields to return null when querying keywords, or is there something I’m missing in my query setup that causes this?

How should I structure my query to filter out keywords when I only want to focus on location, demographic, and device targeting?
I attempted to use the following query to exclude keywords:

SELECT
  ad_group_criterion.type,
  ad_group_criterion.location.geo_target_constant,
  ad_group_criterion.age_range.type,
  ad_group_criterion.gender.type,
  ad_group_criterion.device.type,
  ad_group_criterion.language.language_constant,
  ad_group_criterion.resource_name
FROM ad_group_criterion
WHERE ad_group_criterion.type != 2
  AND campaign.id = ${campaignId}

But I still have some uncertainty about how ad group criteria are structured in the Google Ads system.

So, does each keyword being created for an ad group also create a targeting criteria in that ad group for that keyword? Even if I haven't specific any targeting?

Google Ads API Forum Advisor

unread,
Sep 25, 2024, 3:02:27 PM9/25/24
to he...@herospace.app, adwor...@googlegroups.com

Hi,

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

AdGroupCriterion is structured in such a way that its report only includes criteria that have been explicitly added to the ad group. That means if the KeywordInfo criterion is added to the Adgroup, then the AdGroupCriterion returns the KeywordInfo criterion in its report.

At the ad group level, you can either target or exclude specific keywords for targeting explicitly.

Regarding the returning null values, particularly for location, age_range, and gender, kindly get back to us with the complete API logs (request and response logs with request-id and request header) generated at your end when retrieving the data via the API so that we will check and get back to you.

If you are using a client library and haven't enabled the logging yet, I would request that you enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

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

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

Thanks,
 
Google Logo Google Ads API Team

 



Reply all
Reply to author
Forward
0 new messages