Beispielabfragen

Auf dieser Seite finden Sie einige SQL-Code-Snippets, die zeigen, Metriken, Segmente und Ressourcen. Sie können diese Abfragen unverändert oder zum Erstellen eigener benutzerdefinierter Abfragen.

Kampagne

SELECT
  campaign.name,
  campaign_budget.amount_micros,
  campaign.status,
  campaign.advertising_channel_type,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  campaign.bidding_strategy_type
FROM campaign
WHERE segments.date DURING LAST_7_DAYS
  AND campaign.status != 'REMOVED'

Anzeigengruppe

SELECT
  ad_group.name,
  campaign.name,
  ad_group.status,
  ad_group.type,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM ad_group
WHERE segments.date DURING LAST_7_DAYS
  AND ad_group.status != 'REMOVED'

Anzeige in der Anzeigengruppe

SELECT
  ad_group_ad.ad.expanded_text_ad.headline,
  ad_group_ad.ad.expanded_text_ad.headline2,
  ad_group_ad.ad.expanded_text_ad.headline3,
  ad_group_ad.ad.final_urls,
  ad_group_ad.ad.expanded_text_ad.description1,
  ad_group_ad.ad.expanded_text_ad.description2,
  campaign.name,
  ad_group.name,
  ad_group_ad.ad.type,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM ad_group_ad
WHERE segments.date DURING LAST_7_DAYS
  AND ad_group_ad.status != 'REMOVED'

Keywords

SELECT
  ad_group_criterion.keyword.text,
  campaign.name,
  ad_group.name,
  ad_group_criterion.keyword.match_type,
  ad_group_criterion.final_urls,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros
FROM keyword_view
WHERE segments.date DURING LAST_7_DAYS
  AND ad_group_criterion.status != 'REMOVED'

Alter (demografische Merkmale)

SELECT
  ad_group_criterion.age_range.type,
  campaign.name,
  ad_group.name,
  ad_group_criterion.bid_modifier,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  campaign.advertising_channel_type
FROM age_range_view
WHERE segments.date DURING LAST_7_DAYS

Geschlecht (demografische Merkmale)

SELECT
  ad_group_criterion.gender.type,
  campaign.name,
  ad_group.name,
  ad_group_criterion.bid_modifier,
  metrics.clicks,
  metrics.impressions,
  metrics.ctr,
  metrics.average_cpc,
  metrics.cost_micros,
  campaign.advertising_channel_type
FROM gender_view
WHERE segments.date DURING LAST_7_DAYS

Geokonstanten nachschlagen

Mit der Ressource location_view können Sie Folgendes abrufen: geo_target_Constant-ID.

SELECT
  campaign.name,
  campaign.id,
  campaign_criterion.criterion_id,
  campaign_criterion.location.geo_target_constant,
  location_view.resource_name,
  metrics.cost_micros,
  metrics.impressions,
  metrics.cost_micros
FROM
  location_view
WHERE
  segments.date DURING LAST_7_DAYS

Beachten Sie, dass die API Standorte anhand ihrer Kriteriums-IDs zurückgibt. Um ihre Anzeigenamen zu erhalten, verwenden Sie die API, um die geo_target_constant-Ressource.

SELECT
  geo_target_constant.canonical_name,
  geo_target_constant.country_code,
  geo_target_constant.id,
  geo_target_constant.name,
  geo_target_constant.status,
  geo_target_constant.target_type
FROM geo_target_constant
WHERE geo_target_constant.resource_name = 'geoTargetConstants/1014044'