GA核心API中get函数返回结果解析

Google Analytics Haran 8年前 (2016-11-22) 5733次浏览 0个评论

一般的用法是service.data().ga().get,用于提取数据,get函数有很多参数,

get(ids=*, start_date=*, end_date=*, metrics=*, max_results=None, filters=None, 
dimensions=None, include_empty_rows=None, sort=None, samplingLevel=None, 
segment=None, start_index=None, output=None)

GA核心API中get函数返回结果解析
返回的结果

{'query': {'start-date': '2016-07-01', 'ids': 'ga:10400**', 'end-date': '2016-08-10',
'dimensions': 'ga:date', 'filters': 'ga:pagePath=~/my/p_login.php', 'sort': ['ga:date'], 
'max-results': 10000, 'start-index': 1, 'metrics': ['ga:users'],
'segment':'users::condition::ga:deviceCategory==desktop'}, 
'itemsPerPage': 10000, 'sampleSize': '122797',
'columnHeaders': [{'name': 'ga:date', 'dataType': 'STRING', 'columnType': 'DIMENSION'},
{'name':'ga:users', 'dataType': 'INTEGER', 'columnType': 'METRIC'}], 
'kind': 'analytics#gaData', 
'rows':
[['20160701', '4809'], ['20160702', '4747'], ['20160703', '4546'], ['20160704', '4659'],
['20160705', '4609'], ['20160706', '4546'], ['20160707', '4722'], ['20160708', '4409'], ['20160709',
'4421'], ['20160710', '4622'], ['20160711', '4672'], ['20160712', '4096'], ['20160713', '4258'],
['20160714', '3870'], ['20160715', '3670'], ['20160716', '3807'], ['20160717', '3482'], ['20160718',
'3958'], ['20160719', '4083'], ['20160720', '3832'], ['20160721', '3444'], ['20160722', '4221'],
['20160723', '3682'], ['20160724', '3770'], ['20160725', '4333'], ['20160726', '3807'], ['20160727',
'3845'], ['20160728', '3770'], ['20160729', '4346'], ['20160730', '4534'], ['20160731', '3845'],
['20160801', '4571'], ['20160802', '4108'], ['20160803', '3607'], ['20160804', '3582'], ['20160805',
'4158'], ['20160806', '4070'], ['20160807', '3532'], ['20160808', '3732'], ['20160809', '4121'],
['20160810', '3532']],
'id': 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga:10400**&dimensi=ga:date&metrics=ga:users&sort=ga:date&filters=ga:pagePath%3D~/my/p_login.php&segment=users::condition::ga:deviceCategory%3D%3Ddesktop&start-date=2016-07-01&end-date=2016-08-10&max-results=20000',
'totalResults': 41,
'totalsForAllResults': {'ga:users': '168428'}, 
'selfLink': 'https://www.googleapis.com/analytics/v3/data/ga?ids=ga:10400**&dimensions=ga:date&metrics=ga:users&sort=ga:date&filters=
ga:pagePath%3D~/my/p_login.php&segment=users::condition::ga:deviceCategory%3D%3Ddesktop&start-
date=2016-07-01&end-date=2016-08-10&max-results=20000', 'sampleSpace': '1537967', 'profileInfo':{'internalWebPropertyId': '10512', 'profileId': '10400132', 'accountId': '63012', 'profileName':
'123 - Web Main View', 'webPropertyId': 'UA-12345-1', 'tableId': 'ga:10400123'},
'containsSampledData': True}
  • query表示查询条件
  • itemsPerPage表示每页的记录数
  • sampleSize 抽样的Session数量
  • columnHeaders 数据表头类型
  • kind表示api类型
  • rows实际数据内容
  • id查询的路径
  • totalResults返回总的记录数
  • totalsForAllResults 返回的合计数
  • selfLink用于分页查询做循环.
  • sampleSpace样本空间大小
  • profileInfo账户信息
  • containsSampledData是否包含抽样数据

API返回的都是字典


如有疑问,可以在文章底部留言或邮件(haran.huang@ichdata.com) 我~
喜欢 (1)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址