SUNScholar/Google Analytics/5.X

From Libopedia
Jump to navigation Jump to search
BACK TO GOOGLE ANALYTICS

Step 1 - Internet Firewall Access

The Google Analytics feature in DSpace needs to consult an external database when doing statistical data lookups.

Therefore you MUST ensure that your repository server has unrestricted access via ports 80 and 443 to the following web site:

http://www.googleapis.com

Consult with your campus network administrator to ensure that your server has the correct access to the Google API web site.

Step 2 - Enable GA

Edit the following file:

nano $HOME/source/dspace/config/xmlui.xconf

Enable the analytics aspect by removing the comments (<!--....-->) surrounding the definition.

See example below.

        <!-- Additionally you may choose to expose your Google Analytics statistics in DSpace -->
        <aspect name="StatisticsGoogleAnalytics" path="resource://aspects/StatisticsGoogleAnalytics/" />

Step 3 - Configure GA

Edit the following file:

nano $HOME/source/dspace/config/modules/google-analytics.cfg

Modify as needed.

See example below:

#---------------------------------------------------------------#
#-------------- GOOGLE STATISTICS CONFIGURATIONS----------------#
#---------------------------------------------------------------#
# These configs are only used by the Google Statistics feature  #
# to retrieve and report Google Analytics statistics.           #
#---------------------------------------------------------------#
#
# The Google Statistics feature makes use of the Google Reporting API v3. At the time of writing the instructions for
# use could be found here https://developers.google.com/analytics/devguides/reporting/core/v3/gdataAuthorization.
# You need to create a Service Account but the instructions are not that clear so here is my attempt to pick out the
# relevant bits...
#
# 1. Logon to Google with whatever email address you use to access/manage your Google Analytics account.
#
# 2. Create a Google Project. This assumes that you are developing some new software and will make use of the
# Google code repository. This is not the case but you need to create the skeleton project before you can
# move on to step 3.
#
# 3. Enable the Analytics API for the project.
#
# 4. Find the 'credentials' link and click on it. The subsequent process will generate the email address and
# certificate referenced below.
#
# 5. Go to your Google Analytics dashboard and create an account for the newly generated email address and give it
# permission to 'Read and Analyze' at account level.


# Not sure if this is required but it was in the example code provided by Google.
application.name = Dummy Project

# Each property (or website in plain english) can have a number of views associated with it. Using the Google
# Analytics dashboard select the property you wish to target and then select the admin section for that property. You
# should then be able to select the 'view settings' for the view you are interested in. The View ID should replace
# 12345678 below. Confusingly the Reporting API refers to the View ID as Table ID.
table.id = ga:12345678

# The email address automatically generated when you created the Service Account.
account.email = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com

# The certificate file automatically generated when you created the Service Account.
certificate.location = /home/dspace/dslweb--privatekey.p12

# Control if the statistics pages should be only shown to authorized users. If enabled, only the administrators
# for the DSpaceObject will be able to view the statistics. If disabled, anyone with READ permissions on the
# DSpaceObject will be able to view the statistics.
authorization.admin.usage = true

Step 4 - Rebuild DSpace

Click on the link in the heading above.