Class: Hyrax::Admin::Analytics::CollectionReportsController

Inherits:
AnalyticsController
  • Object
show all
Includes:
BreadcrumbsForCollectionAnalytics
Defined in:
app/controllers/hyrax/admin/analytics/collection_reports_controller.rb

Instance Method Summary collapse

Methods included from BreadcrumbsForCollectionAnalytics

#add_breadcrumb_for_action, #add_breadcrumb_for_controller, #mark_active_action

Methods included from Breadcrumbs

#add_breadcrumb_for_action, #add_breadcrumb_for_controller, #build_breadcrumbs, #default_trail, #trail_from_referer

Methods inherited from AnalyticsController

#date_range, #paginate, #set_date_range, #set_document, #set_months

Methods included from SingularSubresourceController

#find_work

Methods included from DenyAccessOverrideBehavior

#deny_access

Instance Method Details

#indexObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/hyrax/admin/analytics/collection_reports_controller.rb', line 7

def index
  return unless Hyrax.config.analytics?

  @pageviews = Hyrax::Analytics.daily_events('collection-page-view')
  @work_page_views = Hyrax::Analytics.daily_events('work-in-collection-view')
  @downloads = Hyrax::Analytics.daily_events('work-in-collection-download')
  @all_top_collections = Hyrax::Analytics.top_events('work-in-collection-view', date_range)
  @top_collections = paginate(@all_top_collections, rows: 10)
  @top_downloads = Hyrax::Analytics.top_events('work-in-collection-download', date_range)
  @top_collection_pages = Hyrax::Analytics.top_events('collection-page-view', date_range)
  respond_to do |format|
    format.html
    format.csv { export_data }
  end
end

#showObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/hyrax/admin/analytics/collection_reports_controller.rb', line 23

def show
  return unless Hyrax.config.analytics?
  @document = ::SolrDocument.find(params[:id])
  @pageviews = Hyrax::Analytics.daily_events_for_id(@document.id, 'collection-page-view')
  @work_page_views = Hyrax::Analytics.daily_events_for_id(@document.id, 'work-in-collection-view')
  @uniques = Hyrax::Analytics.unique_visitors_for_id(@document.id)
  @downloads = Hyrax::Analytics.daily_events_for_id(@document.id, 'work-in-collection-download')
  respond_to do |format|
    format.html
    format.csv { export_data }
  end
end