Skip to content

The Readership Map provides an interactive, near-real-time visualization of actual visits to an institutional repository using data from Google Analytics

Notifications You must be signed in to change notification settings

zhang4952/Readership-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Readership Map

Setup

Three environment variables must be set:

  • GA_PROFILE_ID - the Google Analytics profile ID ('ga:XXXXXXXX')
  • GSA_CLIENT_EMAIL - the client email for the Google service account
  • GSA_PRIVATE_KEY - the private key for the Google service account

The GSA_... fields can be copied from a Google service account credentials JSON file downloaded from the Developer Console. The variables can be set either outside the application or in an application.yml file placed in the /config directory. The file should contain the lines

GA_PROFILE_ID: 'ga:XXXXXXXX'
GSA_CLIENT_EMAIL: '[email protected]'
GSA_PRIVATE_KEY: '-----BEGIN PRIVATE KEY-----...'

To run in production mode, the variable SECRET_KEY_BASE also needs to be set with a secret token for the Rails app.

There are several optional configuration variables:

  • GA_TIME_ZONE - the time zone associated with the Google Analytics data in the form of a region name (default is 'America/Los_Angeles')
  • GA_FILTERS - filters to be applied to the path part of URIs when querying Google Analytics (see the documentation)
  • RM_QUERY_INTERVAL - minutes between queries by the map for new data
  • RM_QUERY_DELAY - minutes of additional delay in the map's display of data
  • RM_DISPLAY_INTERVAL - minutes between the display of the map's "live" data
  • RM_MAX_TITLE_LENGTH - maximum number of characters for item titles displayed in the map's pop-up info window (longer titles are truncated)
  • RM_INITIAL_HISTORY - minutes of data preceding the "live" data with which to initialize the map on startup
  • RM_HEADER_TEXT - text to display in the map's header
  • RM_FOOTER_TEXT - text to display in the map's footer
  • RM_LAST_UPDATED - the date of last update (in text form, any format)

Usage

  • /data/recent[.json][?minutes=n] returns the last n minutes of readership data (60 minutes if minutes is not specified)
  • / displays the map with live readership data

About

The Readership Map provides an interactive, near-real-time visualization of actual visits to an institutional repository using data from Google Analytics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published