我正在使用 Legato gem 从 Ruby 中的 Google Analytics 访问某个事件的总数,但我得到的结果与 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
...然后我通过这样做来使用它:
query = Analytics::ViewedContent.my_org.results(profile, {
:start_date => start_date,
:end_date => end_date
})
...并查看totalEvents
统计数据。
当我在一月份传递日期时,例如start_date = "2014-01-01".to_date
然后end_date = "2014-01-31".to_date
它工作正常,并将相同数量的返回totalEvents
到谷歌分析网络界面。
但是,当我在上个月使用它时,start_date = "2014-07-01".to_date
它end_date = "2014-07-31".to_date
比在 Web 界面中要少得多(Legato 在 Web 界面中返回 555 与 662)。
It makes me wonder if it's something to do with British Summer Time (I'm currently in UTC+1) except that even extending the date range by a day either side doesn't bring it up to the same as what the web interface reports, which would appear to rule that out.
Any thoughts much appreciated!