Background

Google Analytics is a popular, and proprietary analytics platform for measuring web traffic to a site. VIVO supports Google Analytics through a Freemarker Template dedicated for the purpose. You will need to sign up for Google Analytics, and use your site domain and your key as part of the configuration.

Google Analytics is not required. If you do not wish to implement Google Analytics, please skip this section.

The method described below is a customization of VIVO. This customization will be lost in an upgrade, or code refresh unless you preserve it and reapply the customization after an upgrade. A method for preserving customizations during an upgrade can be found here: Preserving Customizations During Build. It is best to plan ahead to preserve customizations.

googleAnalytics.ftl

To implement Google Analytics for VIVO, follow the steps below.

  1. Sign up for Google Analytics. Have your page key, your roll-up key and the site domain name of your VIVO production site ready.
  2. If you are not using the default VIVO theme, copy googleAnalytics.ftl from the default theme (wilma) found here: ./webapp/src/main/webapp/themes/wilma/templates/googleAnalytics.ftl
  3. Edit googleAnalytics.ftl in the theme you are using. Provide your domain name, your page tracker key, and your roll-up tracker key.
  4. mvn install -Dskiptests
  5. Restart Tomcat. As you develop more experience with customizing the VIVO interface, and working with VIVO, you may be able to bypass some caching and make changes that will be picked up immediately by Tomcat. In such cases you may not need to restart Tomcat. See Extending and Localizing VIVO

Other analytics platforms

It is possible to use other analytics platforms. For example, if you want to use Matomo, you can substitute the tracking script from Google Analytics with the one provided by Matomo.