-
Notifications
You must be signed in to change notification settings - Fork 1
Adding Google Analytics in Scholar
Katie Macke edited this page Sep 20, 2017
·
1 revision
- Go to the analytics console
- Go to
Admin
at the bottom of the sidebar. - Click the dropdown in the middle column
- Click
create new property
- Fill out the form and click
Get tracking ID
- Go to the Google Console and create a new project if needed
- Go to
Enable APIs and Services
and enable the Google+ and Google Analytics API - Go to
Credentials
in the sidebar on the left - Click
Create credentials > Service Account Key
- Create a new service account with a minimum role of
project > viewer
- Save the service account ID and select P12 as the key type then click create.
- Save the file to disk and keep the private key password google generates for you.
- got back to the analytics console and go to the admin page
- Click on
User management
in the second column - Add
Read and Analyze
permissions for your service account ID
- 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"
- Edit
config/initializers/hyrax.rb
- set
config.analytics
totrue
- 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)