Module: Spotlight::ExhibitAnalytics
- Included in:
- Exhibit
- Defined in:
- app/models/concerns/spotlight/exhibit_analytics.rb
Overview
Exhibit mixin to provide analytics data
Instance Method Summary collapse
- #analytics(start_date = 1.month, path = nil) ⇒ Object
- #page_analytics(start_date = 1.month, path = nil) ⇒ Object
Instance Method Details
#analytics(start_date = 1.month, path = nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'app/models/concerns/spotlight/exhibit_analytics.rb', line 5 def analytics(start_date = 1.month, path = nil) return OpenStruct.new unless analytics_provider && analytics_provider.enabled? @analytics ||= {} @analytics[start_date] ||= begin analytics_provider.exhibit_data(path || self, start_date: start_date.ago) end end |
#page_analytics(start_date = 1.month, path = nil) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/models/concerns/spotlight/exhibit_analytics.rb', line 14 def page_analytics(start_date = 1.month, path = nil) return [] unless analytics_provider && analytics_provider.enabled? @page_analytics ||= {} @page_analytics[start_date] ||= begin analytics_provider.page_data(path || self, start_date: start_date.ago) end end |