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?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/e0ac2d2d-29da-441c-b2e0-17f69d7628c6n%40googlegroups.com.
  • Mi... Claudia Sanchez
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to