Missing adgroups when calling the Google Ads API

37 views
Skip to first unread message

Claudia Sanchez

unread,
Oct 5, 2023, 9:32:00 AM10/5/23
to Google Ads API and AdWords API Forum
Hi Team:

We are using the Google Ads API to get the list of adgroups every 15 minutes.
We use this script to call the Google Ads API:

async function getGoogleAdsDataFromBO(
  nextPageToken,
  startDate,
  endDate,
  accessToken,
  clientConfig,
  account
) {
  console.log(`<< Obtaining ad groups for ${account} account...>>`);
  //initial query, this is used when we just need to query the first 10000 adGroups
  const dataWithoutNextPage = JSON.stringify({
    pageSize: 10000,
    query: `SELECT segments.date,
ad_group.ad_rotation_mode,
ad_group.base_ad_group,
ad_group.campaign,
ad_group.cpc_bid_micros,
ad_group.cpm_bid_micros,
ad_group.cpv_bid_micros,
ad_group.display_custom_bid_dimension,
ad_group.effective_target_cpa_micros,
ad_group.effective_target_cpa_source,
ad_group.effective_target_roas,
ad_group.effective_target_roas_source,
ad_group.id,
ad_group.labels,
ad_group.name,
ad_group.resource_name,
ad_group.status,
ad_group.target_cpa_micros,
ad_group.target_cpm_micros,
ad_group.target_roas,
ad_group.type,
metrics.absolute_top_impression_percentage,
metrics.active_view_cpm,
metrics.active_view_ctr,
metrics.active_view_impressions,
metrics.active_view_measurability,
metrics.active_view_measurable_cost_micros,
metrics.active_view_measurable_impressions,
metrics.active_view_viewability,
metrics.all_conversions,
metrics.all_conversions_by_conversion_date,
metrics.all_conversions_from_interactions_rate,
metrics.all_conversions_value,
metrics.all_conversions_value_by_conversion_date,
metrics.average_cost,
metrics.average_cpc,
metrics.average_cpe,
metrics.average_cpm,
metrics.average_cpv,
metrics.average_page_views,
metrics.average_time_on_site,
metrics.bounce_rate,
metrics.clicks,
metrics.conversions,
metrics.conversions_by_conversion_date,
metrics.conversions_from_interactions_rate,
metrics.conversions_value,
metrics.conversions_value_by_conversion_date,
metrics.cost_micros,
metrics.cost_per_all_conversions,
metrics.cost_per_conversion,
metrics.cost_per_current_model_attributed_conversion,
metrics.cross_device_conversions,
metrics.ctr,
metrics.current_model_attributed_conversions,
metrics.current_model_attributed_conversions_value,
metrics.engagement_rate,
metrics.engagements,
metrics.gmail_forwards,
metrics.gmail_saves,
metrics.gmail_secondary_clicks,
metrics.impressions,
metrics.interaction_event_types,
metrics.interaction_rate,
metrics.interactions,
metrics.percent_new_visitors,
metrics.phone_calls,
metrics.phone_impressions,
metrics.phone_through_rate,
metrics.search_absolute_top_impression_share,
metrics.search_budget_lost_absolute_top_impression_share,
metrics.search_budget_lost_top_impression_share,
metrics.search_exact_match_impression_share,
metrics.search_impression_share,
metrics.search_rank_lost_absolute_top_impression_share,
metrics.search_rank_lost_impression_share,
metrics.search_rank_lost_top_impression_share,
metrics.search_top_impression_share,
metrics.top_impression_percentage,
metrics.value_per_all_conversions,
metrics.value_per_all_conversions_by_conversion_date,
metrics.value_per_conversion,
metrics.value_per_conversions_by_conversion_date,
metrics.value_per_current_model_attributed_conversion,
metrics.video_quartile_p100_rate,
metrics.video_quartile_p25_rate,
metrics.video_quartile_p50_rate,
metrics.video_quartile_p75_rate,
metrics.video_view_rate,
metrics.video_views,
metrics.view_through_conversions
FROM ad_group WHERE segments.date >= '${startDate}' and segments.date <= '${endDate}'`,
  });

  //this query is used to get the next 10000 adGroups with the pageToken property
  const dataWithNextPage = JSON.stringify({
    pageSize: 10000,
    query: `SELECT segments.date,
ad_group.ad_rotation_mode,
ad_group.base_ad_group,
ad_group.campaign,
ad_group.cpc_bid_micros,
ad_group.cpm_bid_micros,
ad_group.cpv_bid_micros,
ad_group.display_custom_bid_dimension,
ad_group.effective_target_cpa_micros,
ad_group.effective_target_cpa_source,
ad_group.effective_target_roas,
ad_group.effective_target_roas_source,
ad_group.id,
ad_group.labels,
ad_group.name,
ad_group.resource_name,
ad_group.status,
ad_group.target_cpa_micros,
ad_group.target_cpm_micros,
ad_group.target_roas,
ad_group.type,
metrics.absolute_top_impression_percentage,
metrics.active_view_cpm,
metrics.active_view_ctr,
metrics.active_view_impressions,
metrics.active_view_measurability,
metrics.active_view_measurable_cost_micros,
metrics.active_view_measurable_impressions,
metrics.active_view_viewability,
metrics.all_conversions,
metrics.all_conversions_by_conversion_date,
metrics.all_conversions_from_interactions_rate,
metrics.all_conversions_value,
metrics.all_conversions_value_by_conversion_date,
metrics.average_cost,
metrics.average_cpc,
metrics.average_cpe,
metrics.average_cpm,
metrics.average_cpv,
metrics.average_page_views,
metrics.average_time_on_site,
metrics.bounce_rate,
metrics.clicks,
metrics.conversions,
metrics.conversions_by_conversion_date,
metrics.conversions_from_interactions_rate,
metrics.conversions_value,
metrics.conversions_value_by_conversion_date,
metrics.cost_micros,
metrics.cost_per_all_conversions,
metrics.cost_per_conversion,
metrics.cost_per_current_model_attributed_conversion,
metrics.cross_device_conversions,
metrics.ctr,
metrics.current_model_attributed_conversions,
metrics.current_model_attributed_conversions_value,
metrics.engagement_rate,
metrics.engagements,
metrics.gmail_forwards,
metrics.gmail_saves,
metrics.gmail_secondary_clicks,
metrics.impressions,
metrics.interaction_event_types,
metrics.interaction_rate,
metrics.interactions,
metrics.percent_new_visitors,
metrics.phone_calls,
metrics.phone_impressions,
metrics.phone_through_rate,
metrics.search_absolute_top_impression_share,
metrics.search_budget_lost_absolute_top_impression_share,
metrics.search_budget_lost_top_impression_share,
metrics.search_exact_match_impression_share,
metrics.search_impression_share,
metrics.search_rank_lost_absolute_top_impression_share,
metrics.search_rank_lost_impression_share,
metrics.search_rank_lost_top_impression_share,
metrics.search_top_impression_share,
metrics.top_impression_percentage,
metrics.value_per_all_conversions,
metrics.value_per_all_conversions_by_conversion_date,
metrics.value_per_conversion,
metrics.value_per_conversions_by_conversion_date,
metrics.value_per_current_model_attributed_conversion,
metrics.video_quartile_p100_rate,
metrics.video_quartile_p25_rate,
metrics.video_quartile_p50_rate,
metrics.video_quartile_p75_rate,
metrics.video_view_rate,
metrics.video_views,
metrics.view_through_conversions
FROM ad_group WHERE segments.date >= '${startDate}' and segments.date <= '${endDate}'`,
    pageToken: nextPageToken,
  });
  // if there's a nextPageToken, then we use that, if not, we use the normal query to get the first adGroup list
  const data = nextPageToken ? dataWithNextPage : dataWithoutNextPage;

  const config = {
    method: "post",
    url: clientConfig.dbUrl,
    headers: {
      "Content-Type": "application/json",
      "developer-token": clientConfig.devToken,
      "login-customer-id": clientConfig.managerId,
      Authorization: `Bearer ${accessToken}`,
    },
    data: data,
  };

  //gets the google ads data and then returns it to the index.js script
  const response = await axios(config);
  const adGroups = response.data.results;
  const nextPageTokenRes = response.data.nextPageToken;
  console.log(`<< Ad groups obtained for ${account} account...>>`);
  console.log(`<< Time range from ${startDate} to ${endDate}...>>`);

  //A. here we get the adGroups, and second the nextPageToken, necessary to get the next 10000 adgroups
  return [adGroups, nextPageTokenRes];
}

We are getting the response from the google Ads API, but when we compare that data with the data showed in Ad groups from the google UI there are missing ad groups in the google Ads API response.  We identified more than 4000 missing ad groups.

The google UI and the Google Ads API are synchronized? Is this an error on our side? or is expected to have those differences between the google Ads API and the Google UI?

Google Ads API Forum Advisor

unread,
Oct 6, 2023, 5:53:42 AM10/6/23
to cla...@ticketspro.com, adwor...@googlegroups.com
Hi,

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

By reviewing your concern, I understand that there is a disparity in data between the Google Ads User Interface (UI) and the Google Ads API. Kindly note that the Google Ads API mirrors the Google Ads UI. We would like to specify first the following when comparing the value of the Google Ads UI and the Google Ads API.
  • The segments and fields of the API and UI should be the same.
  • The date range should also be the same.
  • Compare the API and UI at the same level as possible.
In order to investigate your issue further, kindly provide us with the complete API  logs (request and response with request-id and request header) generated at your end and uncropped UI screenshot of the Google Ads account where you are facing the issue.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby 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:_00D1U1174p._5004Q2pP9s8:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages