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(dates = { start_date: '365daysAgo', end_date: 'today' }, path = nil) ⇒ Object
- #analytics_provider ⇒ Object
- #page_analytics(dates = { start_date: '365daysAgo', end_date: 'today' }, path = nil) ⇒ Object
Instance Method Details
#analytics(dates = { start_date: '365daysAgo', end_date: 'today' }, path = nil) ⇒ Object
7 8 9 10 11 |
# File 'app/models/concerns/spotlight/exhibit_analytics.rb', line 7 def analytics(dates = { start_date: '365daysAgo', end_date: 'today' }, path = nil) return OpenStruct.new unless analytics_provider&.enabled? analytics_provider.exhibit_data(path || self, dates) end |
#analytics_provider ⇒ Object
19 20 21 |
# File 'app/models/concerns/spotlight/exhibit_analytics.rb', line 19 def analytics_provider @analytics_provider ||= Spotlight::Engine.config.analytics_provider.new end |
#page_analytics(dates = { start_date: '365daysAgo', end_date: 'today' }, path = nil) ⇒ Object
13 14 15 16 17 |
# File 'app/models/concerns/spotlight/exhibit_analytics.rb', line 13 def page_analytics(dates = { start_date: '365daysAgo', end_date: 'today' }, path = nil) return [] unless analytics_provider&.enabled? analytics_provider.page_data(path || self, dates) end |