As with other campaign types, you can use
GoogleAdsService.SearchStream
to retrieve attributes and performance metrics for Smart campaigns.
Smart campaign metrics are available from the campaign
resource, and search-term specific metrics are available from the
smart_campaign_search_term_view
resource. In the smart_campaign_search_term_view
, the
search_term
field contains any matching queries that generated results.
Impressions and clicks of Smart campaigns in last 30 days
The query below retrieves impressions and clicks for each search term from the last 30 days for all Smart campaigns, segmented by date.
SELECT
campaign.id,
campaign.name,
segments.date,
metrics.impressions,
metrics.clicks,
smart_campaign_search_term_view.search_term
FROM smart_campaign_search_term_view
WHERE segments.date DURING LAST_30_DAYS
Top 10 search terms by impressions
The query below retrieves the top 10 search terms that have generated the most impressions over the past 30 days, along with their cost.
SELECT
campaign.id,
campaign.name,
segments.date,
metrics.impressions,
metrics.cost_micros,
smart_campaign_search_term_view.search_term
FROM smart_campaign_search_term_view
ORDER BY metrics.impressions DESC
LIMIT 10
Retrieve attributes of a KeywordThemeConstant
Since KeywordThemeConstants
are retrieved from a large dataset that is not
customer-specific, it's not possible to scan the entire
keyword_theme_constant
resource all at once. To retrieve individual KeywordThemeConstants
, you must
query the campaign_criterion
resource to find
the resource names of the keyword themes associated with your campaigns, then
use those resource names to filter the keyword_theme
resource.
SELECT
campaign_criterion.type,
campaign_criterion.status,
campaign_criterion.criterion_id,
campaign_criterion.keyword_theme.keyword_theme_constant
FROM campaign_criterion
WHERE campaign_criterion.type = KEYWORD_THEME
Now use the resource name in the
campaign_criterion.keyword_theme.keyword_theme_constant
field in the following
query:
SELECT
keyword_theme_constant.resource_name,
keyword_theme_constant.display_name,
keyword_theme_constant.country_code
FROM keyword_theme_constant
WHERE keyword_theme_constant.resource_name = 'keywordThemeConstants/40804~0'
Reporting functionality requirements
In order to implement Smart campaigns, your application must satisfy a set of required minimum functionality (RMF).
For reporting specifically, a number of reporting fields must be made available to the end user. Here's how to retrieve the required fields from item number R.20 Campaign Performance in the RMF:
SELECT
metrics.clicks,
metrics.cost_micros,
metrics.impressions,
metrics.conversions,
metrics.all_conversions
FROM campaign
And, here's how to retrieve the required fields from item number R.70 Smart Campaign Search Term View:
SELECT
metrics.clicks,
metrics.cost_micros
FROM smart_campaign_search_term_view
Per-store metrics
Here's a query that includes all of the available per-store metrics. These fields can also be combined with other fields in a single query:
SELECT
metrics.all_conversions_from_click_to_call,
metrics.all_conversions_from_directions,
metrics.all_conversions_from_menu,
metrics.all_conversions_from_order,
metrics.all_conversions_from_other_engagement,
metrics.all_conversions_from_store_visit,
metrics.all_conversions_from_store_website
FROM campaign
Phone calls segmented by hour
Here's how to retrieve all phone call metrics between 12 PM and 5 PM:
SELECT
segments.hour,
metrics.phone_calls
FROM campaign
WHERE segments.hour BETWEEN 12 and 17