【发布时间】:2017-11-09 14:01:51
【问题描述】:
基于此处的示例:https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-py
我正在尝试在公共图书馆目录中查找搜索结果信息。我可以通过填写适当的指标和维度来获得结果,但我不知道如何将“排序”集成到
def get_report(analytics):
"""Queries the Analytics Reporting API V4.
Args:
analytics: An authorized Analytics Reporting API V4 service object.
Returns:
The Analytics Reporting API V4 response.
"""
return analytics.reports().batchGet(
body={
'reportRequests': [
{
'viewId': VIEW_ID,
'dateRanges': [{'startDate': '1daysAgo', 'endDate': 'today'}],
'metrics': [{'expression': 'ga:avgSearchResultViews'}],
'dimensions': [{'name': 'ga:searchKeyword'}],
}]
}
).execute()
有谁知道我如何在上面的代码块中集成排序和可能的 maxResults 限制器?谷歌在这里有关于排序的信息:https://developers.google.com/analytics/devguides/reporting/core/v3/reference#sort。我已经尝试在指标表达式中添加“-”,甚至为“排序”添加一个全新的行,但它还不能帮助我。
【问题讨论】:
标签: python sorting google-analytics google-analytics-firebase