我正在使用Legato gem来访问Ruby中的Google中某个事件的总数,但是我得到的结果与web界面不一致。
我有一个这样的模型:
module Analytics
class ViewedContent
extend Legato::Model
metrics :users, :new_users, :total_events
filter :my_org do
# Look u[ event_label=X AND event_action=Y
[
eql(:event_label, "My Organisation", Legato.and_join_character),
eql(:event_action, 'Viewed_Content', Legato.and_join_character)
]
end
end
end ...then --我通过这样做来使用它:
query = Analytics::ViewedContent.my_org.results(profile, {
:start_date => start_date,
:end_date => end_date
})...and正在查看totalEvents统计数据。
当我在一月份传递日期时,例如start_date = "2014-01-01".to_date和end_date = "2014-01-31".to_date,它工作得很好,并将相同数量的totalEvents返回到Google界面。
然而,当我上个月使用它时,start_date = "2014-07-01".to_date和end_date = "2014-07-31".to_date的比web接口中的要少得多(Legato在web接口中返回555和662 )。
这让我想知道这是否与英国夏季时间有关(我目前在UTC+1工作),但即使将日期范围延长一天,也不会与网络界面报告的内容相同,这似乎排除了这一点。
任何想法都很感激!
发布于 2014-08-26 12:58:53
在查询资源器的帮助下,我发现这个问题肯定是在谷歌的末端,而不是因为Legato。问题在于这里的这一行:
metrics :users, :new_users, :total_events 如果我将其更改为只获取:total_events,那么它突然开始返回与Google界面相同的值。现在,我通过查找一个段(而不仅仅是这个过滤器),为:users和:new_users单独提出一个请求。
https://stackoverflow.com/questions/25489652
复制相似问题