# IRStats2 configuration file $c->{irstats2} = {}; ################## # Data Processing ################## # list of (EPrints) datasets to process: $c->{irstats2}->{datasets} = { eprint => { incremental => 0 }, access => { filters => [ 'Robots', 'Repeat' ] }, history => { incremental => 1 }, # user => { incremental => 0 }, }; ####### # Sets ####### # Defining new sets: # # A new set 'X' fills in the statement: "I want to be able to see downloads per X". For instance, for 'divisions': "I want to be able to see downloads per divisions" etc. # # A new grouping, withing a set, fills in the statement: "I want to be able to see Top Y per set". For instance for the set 'divisions' and the grouping 'authors': "I want to be able to see Top Authors per Divisions". # This is why you don't have (by default) the grouping 'subjects' under 'divisions': "I want to see the Top Subjects per Divisions" (I don't find that stat particularly useful but you may). # $c->{irstats2}->{sets} = [ { 'field' => 'divisions', 'groupings' => [ 'authors' ] }, { 'field' => 'subjects', 'groupings' => [ 'authors' ] }, { 'name' => 'type', 'field' => 'type', 'groupings' => [ 'authors' ] }, # # EdShare: # { # 'field' => 'courses', # } # using creators_name and creators_id { 'name' => 'authors', 'field' => 'creators', 'groupings' => [ 'type' ], 'anon' => 1, # don't show user's email address (the 'id' field) # for compound: # if use_ids == 0 -> just use _name, same as having field => 'creators_name' # if use_ids == 1 -> use _id as key for the set and _name for display - value will be ignored if _id is NOT set! 'use_ids' => 1, # 'id_field' => 'id', # default value, optional. if the subfield is called 'email' then use 'email' # If your set returns too much data when no filter is applied, this forces at least n characters # to be used for the filter before results are returned. # 'minimum_filter_length' => 2, #integer }, # # just using creators_name # { # 'name' => 'authors', # 'field' => 'creators_name', # }, # # { 'field' => 'userid' }, ]; ############### # Misc Options ############### ##only show live items in the stats $c->{irstats2}->{show_archive_only} = 1; # by default, anyone can view the stats. Comment out to enable only users with the special '+irstats2/view' role to view stats. push @{$c->{public_roles}}, "+irstats2/view"; push @{$c->{public_roles}}, "+irstats2/export"; # The method below is called by the /cgi/stats/* scripts which handle the delivery of stats $c->{irstats2}->{allow} = sub { my( $session, $priv ) = @_; return 0 unless( defined $priv ); # Un-comment the following block if you want to restrict access to stats (e.g. to restricted users) BUT you still want some stats graphs # to display on the summary pages # # if( $session->get_online ) # { # # Allow any requests coming from a summary page # my $referer = EPrints::Apache::AnApache::header_in( # $session->get_request, # 'Referer' ); # if( defined $referer ) # { # my $hostname = $session->config( 'host' ) or return 0; # # return 1 if( $referer =~ /^https?:\/\/$hostname\/\d+\/?$/ ); # } # } return 1 if( $session->allow_anybody( $priv ) ); return 0 if( !defined $session->current_user ); return $session->current_user->allow( $priv ); }; # Specify a default time range if none are specified (by default, all the stats are returned). #$c->{irstats2}->{default_range} = '1y'; # Local Domains for Referrers # STRING => REGEX_PATTERN # For example: # $c->{irstats2}->{local_domains} = { "ECS Intranet" => "\\.ecs\\.soton\\.ac\\.uk", "University Intranet" => "\\.soton\\.ac\\.uk" }; # time-out for the so-called "double-click" filtering - default to 3600 secs = 1 hour $c->{plugins}->{"Stats::Filter::Repeat"}->{params}->{timeout} = 3600 * 24; # prevents EPrints 3.2 from breaking (because that trigger isn't implemented in that versin of EPrints) # the value '16' comes from EPrints::Const::EP_TRIGGER_DYNAMIC_TEMPLATE $EPrints::Plugin::Stats::EP_TRIGGER_DYNAMIC_TEMPLATE ||= 16; # Trigger to load the Google Charts library from the template(s) $c->add_trigger( $EPrints::Plugin::Stats::EP_TRIGGER_DYNAMIC_TEMPLATE, sub { my( %args ) = @_; my( $repo, $pins ) = @args{qw/ repository pins/}; my $protocol = $repo->get_secure ? 'https':'http'; my $head = $repo->make_doc_fragment; $head->appendChild( $repo->make_javascript( undef, src => "$protocol://www.google.com/jsapi" ) ); $head->appendChild( $repo->make_javascript( 'google.load("visualization", "1", {packages:["corechart", "geochart"]});' ) ); if( defined $pins->{'utf-8.head'} ) { $pins->{'utf-8.head'} .= $repo->xhtml->to_xhtml( $head ); } if( defined $pins->{head} ) { $head->appendChild( $pins->{head} ); $pins->{head} = $head; } else { $pins->{head} = $head; } return EP_TRIGGER_OK; } ); # Hide the link to the reports by default: $c->{plugins}->{"Screen::IRStats2::Report"}->{appears}->{key_tools} = undef; ########## # Reports ########## # # Reports definition # # Structure: # $c->{irstats2}->{report} = { # # $report_name => { # items => [ # { # plugin => '$View_plugin_name', # # # then pass extra optional arguments: # show_title => 0 or 1, # title => 'My Custom Title', # custom_css => 'border:0px;font:12px;', # # # then other arguments are Plugin-specific: # # # for any data-related View plugin: # datatype => '$some_data_type', # datafilter => '$some_data_filter' # grouping => '$some_grouping' # # # for Timeline: # ranges => [ '1m', '6m', '1y' ], # Ranges to show in the