Sha256: ad5b500c616f1237eca134cc030738512771c1f0dec6b95822ae7473a0bba80f

Contents?: true

Size: 760 Bytes

Versions: 35

Compression:

Stored size: 760 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  ##
  # Exhibit mixin to provide analytics data
  module ExhibitAnalytics
    def analytics(start_date = 1.month, path = nil)
      return OpenStruct.new unless analytics_provider&.enabled?

      @analytics ||= {}
      @analytics[start_date] ||= analytics_provider.exhibit_data(path || self, start_date: start_date.ago)
    end

    def page_analytics(start_date = 1.month, path = nil)
      return [] unless analytics_provider&.enabled?

      @page_analytics ||= {}
      @page_analytics[start_date] ||= analytics_provider.page_data(path || self, start_date: start_date.ago)
    end

    def analytics_provider
      @analytics_provider ||= Spotlight::Engine.config.analytics_provider.new
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.3 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.4.2.2 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.4.2.1 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.4.2 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.4.1 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.4.0 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.3.0 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.2.0 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.1.0 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.0.3 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.0.2 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.0.1 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.0.0 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.0.0.rc6 app/models/concerns/spotlight/exhibit_analytics.rb
blacklight-spotlight-3.0.0.rc5 app/models/concerns/spotlight/exhibit_analytics.rb