About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
configuration:usage_stats

Collecting Usage Statistics

It is often extremely helpful to measure user behavior in order to evaluate strengths and weaknesses of your user interface, your indexing rules and your underlying collection.

VuFind® offers several options for collecting usage statistics.

Google Analytics

Google Analytics is a very popular hosted solution for gathering site statistics. VuFind® offers out-of-the-box GA support through the [GoogleAnalytics] section of config.ini.

Some Tips for Using Google Analytics

Google Analytics provides a variety of ways to track web traffic to gain a better understanding of how users find and use your website. Here are a few tips for using Google Analytics with VuFind®.

  • Use the Content Drilldown option to examine what parts of the site users are visiting.
    On the sidebar menu, navigate to Behavior → Site Content → Content Drilldown. In the main pane select /vufind/ in the Page path level 1 column.
    This will show you the number of page views of records (/Records/), searches (/Search/, /Author/ (author search)), browsing activity (/Browse/ and /Alphabrowse/), and any custom pages you have created. Unless you specify a date range (in the upper right of the main pane), Google Analytics will set the date range to the last 30 day period.
  • Use the Channels option to explore how visitors are finding your website.
    On the sidebar menu, navigate to Acquisition → All Traffic → Channels
    This will show you the amount of traffic the site is receiving from search engine queries (Organic searches), from users going directly to the website (Direct), from social media (Social), and from other sites referring traffic to your site (Referral). You can click on one of the traffic channels, such as Referrals, and then set the “Secondary Dimension” pull-down menu to “Full Referrer” to see which sites are referring traffic to your website.
  • Discover the most popular content on your website.
    On the sidebar menu, navigate to Behavior → Site Content → Content Drilldown. In the main pane select /vufind/ in the Page path level 1 column.
    To see the most frequently visited records, click on /Record/ and click on the Unique Pageviews column to sort the data from highest to lowest value. You can repeat these steps for /Searches/ to see which searches are most common.

In addition to the above tips Google Spreadsheet now has an Add-on for Google Analytics. You can create custom analytics reports and then create an analytics dashboard on your website using those custom charts for your administrative users to view.

Matomo 4+

Available starting with VuFind® 8.0.

(see also legacy Piwik/Matomo 3.x support below)

Matomo (formerly called Piwik) is an open source project which offers similar functionality to Google Analytics but allows the data to be collected to a locally-hosted server rather than a third-party service. For libraries with concerns about privacy and applications of user-generated data, this may be a preferred option. The [Matomo] section of config.ini allows simple integration with a Matomo server.

Enabling tracking with [Matomo] section instead of the legacy [Piwik] section is recommended whenever possible, as it uses newer tracking code and also provides support for Custom Dimensions in Matomo. Matomo recommends using Custom Dimensions instead of Custom Variables. See https://matomo.org/docs/custom-dimensions/ for more information.

Tips and Notes

Custom Variables and Custom Dimensions are not tracked when the content is loaded using AJAX (for example, when using AJAX tabs on the record view, or when tabs or accordion segments are loaded with the list view set to “tabs” or “accordion” in the [List] section of searches.ini). If you wish to track the custom variables in this case too, change 'lightbox' to an empty string in the matomo call in lightbox.phtml.

themes/bootstrap3/templates/layout/lightbox.phtml:

Replace (line 3):

<?=$this->matomo(['context' => $this->layoutContext ?? 'lightbox'])?>

with:

<?=$this->matomo(['context' => $this->layoutContext ?? ''])?>

This may skew your results in unpredictable ways, so be sure to test carefully. It may be necessary to create a special custom layout template and adjust additional code if you wish to track AJAX statistics in some cases but not others.

Piwik/Matomo 3.x

The [Piwik] section of config.ini allows integration with legacy Piwik/Matomo 3.x. However, enabling tracking with [Matomo] section as described above is recommended whenever possible.

Tips and Notes

Custom variables are not tracked when the content is loaded using AJAX (for example, when using AJAX tabs on the record view, or when tabs or accordion segments are loaded with the list view set to “tabs” or “accordion” in the [List] section of searches.ini). If you wish to track the custom variables in this case too, remove the “lightbox = true” entry in the lightbox.phtml in the piwik call.

themes/bootstrap3/templates/layout/lightbox.phtml:

Replace (line 2):

piwik(['lightbox' => true])?> 

with:

piwik()?> 

This may skew your results in unpredictable ways, so be sure to test carefully. It may be necessary to create a special custom layout template and adjust additional code if you wish to track AJAX statistics in some cases but not others.

Google Tag Manager

Available starting with VuFind® 9.0.

Google Tag Manager is a platform for deploying a variety of Javascript code snippets (“tags”) onto a website/webapp based on specific criteria (“triggers”). It supports built-in tags for Google Analytics v4 (and earlier, deprecated versions) as well as a community-provided library of tags that includes Matomo.

Configure VuFind®'s out-of-the-box support for GTM through the [GoogleTagManager] section of config.ini.

Enhanced UI Tracking with GTM and GA4

Event Tracking in GA can be used to measure the use of particular UI features beyond page navigation. GTM makes it possible to do this without any custom Javascript. For example, this example GTM tag and trigger record the use of the “record navigation” / “action toolbar” buttons like “Cite this” and “Text this”.

Tag Configuration panel showing Tag Type is GA4 Event, Event Name is "click", Event Parameters are "section" => "action_toolbar" and "link_text" => a GTM variable "Click Text"

Trigger Configuration panel showing Trigger Type is "Click - All Elements" and the trigger fires on "Click Element matches CSS selector .record-nav a"

Built-In Statistics Collection

:!: Early versions of VuFind® included built-in data collection mechanisms, but these were removed in VuFind® 4.0 since external services like Google Analytics and Piwik/Matomo have much richer functionality.

configuration/usage_stats.txt · Last modified: 2023/11/09 19:18 by demiankatz