Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding example for searchAppearance #414

Merged
merged 1 commit into from
Dec 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion samples/searchconsole/search_analytics_api_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ def main(argv):
response = execute_request(service, flags.property_uri, request)
print_table(response, 'Group by country and device')

# Group by total number of Search Appearance count.
# Note: It is not possible to use searchAppearance with other
# dimensions.
request = {
'startDate': flags.start_date,
'endDate': flags.end_date,
'dimensions': ['searchAppearance'],
'rowLimit': 10
}
response = execute_request(service, flags.property_uri, request)
print_table(response, 'Search Appearance Features')

def execute_request(service, property_uri, request):
"""Executes a searchAnalytics.query request.
Expand All @@ -165,7 +176,7 @@ def print_table(response, title):
response: The server response to be printed as a table.
title: The title of the table.
"""
print title + ':'
print '\n --' + title + ':'

if 'rows' not in response:
print 'Empty response'
Expand Down