Новый API отчетов Search Ads 360 теперь доступен. Присоединяйтесь к группе Google searchads-api-announcements , чтобы быть в курсе предстоящих улучшений и выпусков.
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
На этой странице собраны некоторые фрагменты кода SQL, которые показывают, как использовать различные поля, метрики, сегменты и ресурсы. Вы можете использовать эти запросы как есть или в качестве отправной точки для создания собственных настраиваемых запросов.
Обратите внимание, что API возвращает местоположения по идентификаторам их критериев. Чтобы получить их отображаемые имена, используйте API для запроса ресурса geo_target_constant .
[[["Прост для понимания","easyToUnderstand","thumb-up"],["Помог мне решить мою проблему","solvedMyProblem","thumb-up"],["Другое","otherUp","thumb-up"]],[["Отсутствует нужная мне информация","missingTheInformationINeed","thumb-down"],["Слишком сложен/слишком много шагов","tooComplicatedTooManySteps","thumb-down"],["Устарел","outOfDate","thumb-down"],["Проблема с переводом текста","translationIssue","thumb-down"],["Проблемы образцов/кода","samplesCodeIssue","thumb-down"],["Другое","otherDown","thumb-down"]],["Последнее обновление: 2025-08-29 UTC."],[[["\u003cp\u003eThis page provides SQL code snippets for querying various Google Ads data, such as campaigns, ad groups, and keywords.\u003c/p\u003e\n"],["\u003cp\u003eThese snippets can be used as-is or customized to build your own queries for extracting specific data points.\u003c/p\u003e\n"],["\u003cp\u003eThe queries primarily focus on performance metrics (clicks, impressions, cost, etc.) and attributes of different Google Ads components.\u003c/p\u003e\n"],["\u003cp\u003eExamples are provided for retrieving data for specific date ranges and filtering by status, like campaigns or ad groups that are not removed.\u003c/p\u003e\n"],["\u003cp\u003eThe page also includes guidance on querying geographical data using location and geo target constant resources.\u003c/p\u003e\n"]]],["The content provides SQL queries for retrieving data from various advertising resources. These queries retrieve information on campaigns, ad groups, ads, keywords, and demographics (age and gender), including metrics like clicks, impressions, and costs. Each query filters data from the last 7 days and excludes removed items. There are additional queries to show how to get location information by the geo constant ID, and how to query for more details on those IDs.\n"],null,["# Sample queries\n\nThis page collects some SQL code snippets that show how to use the different\nfields, metrics, segments and resources. You can use these queries as is or as\nstarting points on for constructing your own customized queries.\n\nCampaign\n--------\n\n SELECT\n campaign.name,\n campaign_budget.amount_micros,\n campaign.status,\n campaign.advertising_channel_type,\n metrics.clicks,\n metrics.impressions,\n metrics.ctr,\n metrics.average_cpc,\n metrics.cost_micros,\n campaign.bidding_strategy_type\n FROM campaign\n WHERE segments.date DURING LAST_7_DAYS\n AND campaign.status != 'REMOVED'\n\nAd Group\n--------\n\n SELECT\n ad_group.name,\n campaign.name,\n ad_group.status,\n ad_group.type,\n metrics.clicks,\n metrics.impressions,\n metrics.ctr,\n metrics.average_cpc,\n metrics.cost_micros\n FROM ad_group\n WHERE segments.date DURING LAST_7_DAYS\n AND ad_group.status != 'REMOVED'\n\nAd Group Ad\n-----------\n\n SELECT\n ad_group_ad.ad.expanded_text_ad.headline,\n ad_group_ad.ad.expanded_text_ad.headline2,\n ad_group_ad.ad.expanded_text_ad.headline3,\n ad_group_ad.ad.final_urls,\n ad_group_ad.ad.expanded_text_ad.description1,\n ad_group_ad.ad.expanded_text_ad.description2,\n campaign.name,\n ad_group.name,\n ad_group_ad.ad.type,\n metrics.clicks,\n metrics.impressions,\n metrics.ctr,\n metrics.average_cpc,\n metrics.cost_micros\n FROM ad_group_ad\n WHERE segments.date DURING LAST_7_DAYS\n AND ad_group_ad.status != 'REMOVED'\n\nKeywords\n--------\n\n SELECT\n ad_group_criterion.keyword.text,\n campaign.name,\n ad_group.name,\n ad_group_criterion.keyword.match_type,\n ad_group_criterion.final_urls,\n metrics.clicks,\n metrics.impressions,\n metrics.ctr,\n metrics.average_cpc,\n metrics.cost_micros\n FROM keyword_view\n WHERE segments.date DURING LAST_7_DAYS\n AND ad_group_criterion.status != 'REMOVED'\n\nAge (Demographics)\n------------------\n\n SELECT\n ad_group_criterion.age_range.type,\n campaign.name,\n ad_group.name,\n ad_group_criterion.bid_modifier,\n metrics.clicks,\n metrics.impressions,\n metrics.ctr,\n metrics.average_cpc,\n metrics.cost_micros,\n campaign.advertising_channel_type\n FROM age_range_view\n WHERE segments.date DURING LAST_7_DAYS\n\nGender (Demographics)\n---------------------\n\n SELECT\n ad_group_criterion.gender.type,\n campaign.name,\n ad_group.name,\n ad_group_criterion.bid_modifier,\n metrics.clicks,\n metrics.impressions,\n metrics.ctr,\n metrics.average_cpc,\n metrics.cost_micros,\n campaign.advertising_channel_type\n FROM gender_view\n WHERE segments.date DURING LAST_7_DAYS\n\nHow to look up geo constants\n----------------------------\n\nUse [location_view](/search-ads/reporting/api/reference/fields/v0/location_view) resource to get a\ngeo_target_constant ID. \n\n SELECT\n campaign.name,\n campaign.id,\n campaign_criterion.criterion_id,\n campaign_criterion.location.geo_target_constant,\n location_view.resource_name,\n metrics.cost_micros,\n metrics.impressions,\n metrics.cost_micros\n FROM\n location_view\n WHERE\n segments.date DURING LAST_7_DAYS\n\nNote that the API returns locations by their criterion IDs.\nTo get their display names, use the API to query the\n[geo_target_constant](/search-ads/reporting/api/reference/fields/v0/geo_target_constant) resource. \n\n SELECT\n geo_target_constant.canonical_name,\n geo_target_constant.country_code,\n geo_target_constant.id,\n geo_target_constant.name,\n geo_target_constant.status,\n geo_target_constant.target_type\n FROM geo_target_constant\n WHERE geo_target_constant.resource_name = 'geoTargetConstants/1014044'"]]