作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Google Analytics Reporting API,但即使指定日期范围内的 session 远少于 500K limit,我也会得到抽样结果。 .我一个月只有约 4K 次 session 。
我还将“samplingLevel”设置为“LARGE”。
这是 Python 查询:
response=analytics.reports().batchGet(
body={
"reportRequests":[
{
"viewId":myViewID,
"dateRanges":[
{
"startDate":"2017-05-01",
"endDate":"2017-05-30"
}],
"samplingLevel":"LARGE",
"metrics":[
{
"expression":"ga:sessions"
}],
"dimensions": [
{
"name":"ga:browser"
},
{
"name":"ga:city",
}
]
}]
}
).execute()
response.get('reports', [])[0].get('data',[]).get('samplesReadCounts',[])
Out[31]: [u'2051']
response.get('reports', [])[0].get('data',[]).get('samplingSpaceSizes',[])
Out[32]: [u'4365']
> web_data <- google_analytics_4(view_id,
+ date_range = c("2017-05-01", "2017-05-30"),
+ dimensions = c("city","browser"),
+ metrics = c("hits"),
+ samplingLevel="LARGE",
+ anti_sample = TRUE)
2017-06-04 11:54:51> anti_sample set to TRUE. Mitigating sampling via multiple API calls.
2017-06-04 11:54:51> Finding how much sampling in data request...
2017-06-04 11:54:52> Downloaded [10] rows from a total of [15].
2017-06-04 11:54:52> Data is sampled, based on 47% of sessions.
2017-06-04 11:54:52> Finding number of sessions for anti-sample calculations...
2017-06-04 11:54:53> Downloaded [30] rows from a total of [30].
2017-06-04 11:54:53> Calculated [3] batches are needed to download approx. [18] rows unsampled.
2017-06-04 11:54:53> Anti-sample call covering 14 days: 2017-05-01, 2017-05-14
2017-06-04 11:54:54> Downloaded [7] rows from a total of [7].
2017-06-04 11:54:54> Data is sampled, based on 53.2% of sessions.
2017-06-04 11:54:54> Anti-sampling failed
2017-06-04 11:54:54> Anti-sample call covering 9 days: 2017-05-15, 2017-05-23
2017-06-04 11:54:54> Downloaded [4] rows from a total of [4].
2017-06-04 11:54:54> Data is sampled, based on 55.7% of sessions.
2017-06-04 11:54:54> Anti-sampling failed
2017-06-04 11:54:54> Anti-sample call covering 7 days: 2017-05-24, 2017-05-30
2017-06-04 11:54:55> Downloaded [10] rows from a total of [10].
2017-06-04 11:54:55> Data is sampled, based on 52.3% of sessions.
2017-06-04 11:54:55> Anti-sampling failed
Joining, by = c("city", "browser")
Joining, by = c("city", "browser")
2017-06-04 11:54:55> Finished unsampled data request, total rows [13]
最佳答案
尽管 https://issuetracker.google.com/issues/62525952 的 session 数很少,但 Google 有一张关于采样的罚单
关于google-analytics - 尽管 session 数较少,但 Google Analytics(分析)抽样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44352148/
我想从列表中抽取项目样本,但我想设置每个项目被包含的概率,而不是要抽取的项目总数(所以 random.sample( ) 不起作用)。我用下面的代码得到了我想要的效果(其中 p 是包含的概率,item
我正在使用 Google Analytics Reporting API,但即使指定日期范围内的 session 远少于 500K limit,我也会得到抽样结果。 .我一个月只有约 4K 次 ses
我是一名优秀的程序员,十分优秀!