Skip to content

Adding Google Analytics in Scholar

Katie Macke edited this page Sep 20, 2017 · 1 revision

Contents

Getting Project ID for GA

  1. Go to the analytics console
  2. Go to Admin at the bottom of the sidebar.
  3. Click the dropdown in the middle column
  4. Click create new property
  5. Fill out the form and click Get tracking ID

Creating GA Account

  1. Go to the Google Console and create a new project if needed
  2. Go to Enable APIs and Services and enable the Google+ and Google Analytics API
  3. Go to Credentials in the sidebar on the left
  4. Click Create credentials > Service Account Key
  5. Create a new service account with a minimum role of project > viewer
  6. Save the service account ID and select P12 as the key type then click create.
  7. Save the file to disk and keep the private key password google generates for you.
  8. got back to the analytics console and go to the admin page
  9. Click on User management in the second column
  10. Add Read and Analyze permissions for your service account ID

Connecting Scholar to GA

  1. Open config/analytics.yml and edit it with your information.
analytics:
  app_name: "App name (chosen by you)"
  app_version: "App version (chosen by you)"
  privkey_path: "Path to P12 key file"
  privkey_secret: "The secret generated by google"
  client_email: "The service account ID"
  1. Edit config/initializers/hyrax.rb
  • set config.analytics to true
  • set config.google_analytics_id to the ID for your analytics project.
  • set config.analytic_start_date to the date you want to start collecting analytics. (Can usually be left empty)
Clone this wiki locally