8 Configuring Google Analytics for Pressbooks

Network managers can configure their network to send information about visitor activity and download statistics to the Google Analytics service.

To do so, you will need to create a Google Analytics property, then add a tracking code to your network. Once the tracking code is added, you will be able to configure views and reports inside Google Analytics.

Creating a Google Analytics Property

In order to use Google Analytics (“GA”), you will need a GA account, and a property for your Pressbooks network inside your GA account. If you need help getting set up, please consult the Google documentation on setting up a GA account and property.

Once your Pressbooks property has been created, copy your GA tracking code (looks like “UA-01234567-8”) and add it to your network by following these steps:

  1. Go to your Network Admin dashboard
  2. Click on Settings > Network Options from the left sidebar menu and select the tab labelled Third Party Tools
  3. Paste your Google Analytics tracking code in the field labeled Google Analytics ID and click Save Changes

You will start receiving data in Google Analytics as soon as the code is added to your network.

Screenshot showing the Google Analytics ID field in Pressbooks
The Google Analytics ID field available to Network Managers in Network Options

Configuring Google Analytics for Pressbooks

By default, all analytics data will be sent to the “All Web Site Data” view, and include data for all frontend and backend (admin) pages. This means the data for all the books on your network will be collected in the same place.

The default setup should cover most use cases for network managers and require no additional configuration.

In some cases, network managers may want to give individual book authors direct access to the analytics data. This can be done in different ways, such as through filtered views or custom reports.

To help you configure your GA, we provide instructions below. However, please note that we cannot offer more in-depth support for Google Analytics.

Filtered views

Filtered views allows you to access the default GA reporting interface, but with a subset of the data.

For more information on Views, please read the Google documentation.

To create a filter for a specific book on your Pressbooks network, configure the filter as follows:

  1. Filter name: insert the name you want to give to your filter, for example the book title.
  2. Filter type: select: Predefined. In the drop-down lists below, select: Include onlytraffic to the subdirectoriesthat contain.
  3. Subdirectory: insert the subdirectory of the book. The subdirectory can be seen in the book’s URL, right after the main domain (ex: https://university.pressbooks.pub/booktitle/). Do include the slashes (‘/’) at the beginning and the end.

Below is an example of a configured book filter:
Screenshot of a configuration example of a book filter.

Once the view has been created, you can give other users access to it. For help, please read the Google documentation on user management.

Custom reports

Google Analytics comes with a number of built-in reports that cover most use cases.

For more information on the default reports in GA, check out the Google documentation on:

If you need to track specific metrics at regular intervals, it may be useful to create custom reports, and set up automatic emails to have them sent at regular intervals.

Automatic emails can also be set up for any of GA’s default reports.


Icon for the Creative Commons Attribution 4.0 International License

The Pressbooks Network Manager's Guide by Pressbooks is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book