Chapter 1. Getting the Best Google Analytics Data for Your Library

Google Analytics is over ten years old,1 and it has proved to be a major player in the digital analytics market. Although Google has not released the exact number of websites using Google Analytics, one marketing publication estimates that over 30 million websites use it worldwide.2 Google Analytics is just as prevalent in the library world. This issue of Library Technology Reports focuses on implementing Google Analytics on a series of library-specific online tools and platforms. The tools covered include

  • journal search tools and link resolvers
  • online catalogs or discovery services
  • Springshare’s LibGuides
  • digital repositories
  • social media

These tools are discussed in later chapters. Each chapter highlights Google Analytics features to produce the best data for these tools.

Before we talk about features, we must talk about common best practices for implementing and utilizing Google Analytics for any website. This first chapter discusses three Google Analytics customizations all libraries should use for any website or online tool. The second chapter will talk solely about the increasingly popular Google Tag Manager and how it greatly simplifies implementing some of these features. Overall, the goal is simple—making Google Analytics give you better data for your various library online tools for improved assessment and decision making.

Google Tag Manager

Best Practices for Google Analytics Tracking

Out of the box, Google Analytics is a useful tool for tracking website usage, but any library can improve how Google Analytics collects and reports data by implementing three additional features: spam filters, event tracking, and conversions. These are essential features to optimize Google Analytics’ data collection ability and are worth the time to implement. These features are disabled by default, and most require administrative-level permissions within the Google Analytics account to enable them. If you do not have administrative permissions for your library’s Google Analytics accounts, talk to the people that do. They can enable these features or give you the permission to do so.

Dealing with Spam Traffic

All web analytics tools are susceptible to junk traffic created by spambots or spamming websites. Google Analytics is no exception. The problem is that spam traffic will visit your website, and Google Analytics will report that session data like any other website user. Data from spam traffic is not just annoying in your usage reports, but is also very deceiving because it tends to inflate negative metrics such as bounce rate.

How can you tell actual user-driven data from junk data? It is not always apparent because in many Google Analytics reports, the junk data is automatically incorporated, making it difficult to discern the useful from the crud. You could go the route of blocking known spammers from your website if you have access to the .htaccess or robots.txt files on the site’s web server,3 but this solution does not work for any website that is not locally hosted. Instead, you can tell Google Analytics not to collect data from known spam traffic by opting into the Bot Filtering feature. To do this, log in to your Google Analytics account and go to the website’s View Settings area within the Admin interface. Checkmark the Bot Filtering option, and save your changes.

Enabling Bot Filtering is the first step. The next step is to monitor Google Analytics Referral report (under Acquisition section) for any suspicious referral traffic. Recent popular offenders are sites that end in .xyz, such as This is a legit top-level domain, but this spammer only drives junk traffic to my website. New spammers are popping up all the time, so it pays to monitor your referral traffic regularly for new spammer sites. Once you identify those spammers, you can create a filter within your Google Analytics account to tell it to not collect any session data from those types of websites. This does not remove past spam traffic from your account, but it does block future data from those spammers.

To create a filter, head over to the Filter option under your website’s View section in Google Analytics’ Admin area. Click the Add Filter button and name your filter. To filter referral traffic, select Custom for Filter Type and select Campaign Source as the Filter Field because it is the best option to remove those spammers. Next add the unique identifier for the spam traffic as a regular expression. In my example (figure 1.1), I remove all traffic that contains the string .xyz in the Campaign Source field. Filters can also remove multiple referral sources at once—simply use a regular expression (RegEx)4 to list them all. You can verify your filter before saving it.

Use filters cautiously because you could accidentally remove good data. I recommend creating a new Google Analytics View for your website before adding a filter. Keep one unfiltered View that has all usage data and another View to apply the filter. This is a safety precaution in case you ever want to review all the data in the unfiltered View to ensure you are not accidently removing actual user content.

Event Tracking

If you are unfamiliar with event tracking, then there is a good chance your Google Analytics is collecting only a portion of your website’s activity because out of the box, Google Analytics can track only data associated with a pageview—when a web page loads in a browser. What does this leave out? A lot! Think links that navigate users away from the website’s domain (outbound links), document downloads, embedded media, and other script-based elements. This is particularly frustrating for libraries because many of our websites are designed to navigate users to a wide variety of sources outside of our library website domain. To counter this, Google Analytics offers event tracking.5 Event tracking is not a Google Analytics administrative feature, but it does require you to edit your website by adding the special event-tracking code for whatever you want Google Analytics to recognize and track as an event. Google Tag Manager seamlessly integrates event-tracking functionality within its interface, which allows you to create and delete events at any time without ever directly touching your website’s code. Google Tag Manager makes event tracking incredibly easy, and the next chapter will demonstrate how to use it.

Event tracking allows you to gather more comprehensive data about your website’s usage so you can tell not just what web pages users visit, but what users do on those pages. All of this data is available in Google Analytics Event reports, which are empty until you start event tracking. The more strategic you are about tracking events, the more useful the data you collect will be.


Conversions are one of the most powerful web analytics metrics available because they can measure the success of a site. Within Google Analytics, conversions are often used interchangeably with goals, but it is important to understand that a conversion is the metric to measure a desired action or response on a website. Conversions are intended to measure your website’s goals (or reasons for existing). By nature, conversions are custom metrics that you must define because they tend to be unique to the website. For example, a link resolver’s main goal is to help users find full text of some electronic resource. The desired action would be for the user to find a full-text link to that content. In conversion terms, this could be measured by a conversion that tracks when users click on that full-text link. The major benefit of tracking this action as a conversion is that it tells you how often this desired action occurs on your website.

Sounds simple enough, yet you want to be conservative with your conversions because you are limited to twenty conversions per Google Analytics View. Additionally, conversions cannot be deleted. Once they are implemented, they may be edited or turned off, but they cannot be removed. Focus on the conversions that align with the website’s goals and purpose. Several chapters in this issue of Library Technology Reports suggest potential conversions for different online tools in your own library.

To track a conversion, you must tell Google Analytics how to identify the conversion and when to track it. Google Analytics simplifies this process by guiding you through the steps. To create or manage your conversions, go to the Goals section for your site’s View found in Google Analytics’ Admin area. Click on the New Goal button to create a goal. Name your Goal and select your Goal Slot, as this will help you organize your conversions. Next, select your goal Type—the most useful two are Destination and Event. A Destination goal is for a conversion where the desired action is a user viewing a specific web page. The Event goal is much more robust because it is used for conversions based on some type of user action. As long as that action is tracked as an event, it can be used to define a conversion. If this does not entice you to join the event-tracking bandwagon, then nothing will because this means any user action can be tracked as a conversion.

Using the link resolver example again, you would track that conversion as an Event goal because full-text links are most likely outbound links; event tracking is required to monitor when users click on those links to navigate away from the link resolver website to the electronic resource’s website. Once you select an Event goal, add the event category or other event descriptors to identify that specific outbound link event, as shown in figure 1.2 on the following page. You can verify the goal to test it before saving it.

Once you save your first goal, you will need to wait twelve to twenty-four hours for any conversion data to populate the various conversion and goal reports. Conversions can also be powerful segments that can be applied to most Google Analytics reports. This can help you understand not only the total number of conversions and where these conversions occur, but also identify the group of users that complete these desired actions.


Hopefully this introduction inspired you to improve how Google Analytics tracks your website regardless of whether it is your library website, catalog, link resolver, or whatever tool you are tracking. The next chapter will focus on Google Tag Manager and how to use it for event tracking to make it even easier for libraries to optimize their Google Analytics tracking and reporting abilities.


  1. Paul Muret, “Happy 10th Birthday, Google Analytics!” Google Analytics Solutions blog, November 12, 2015,
  2. Matt McGee, “As Google Analytics Turns 10, We Ask: How Many Websites Use It?” MarketingLand, November 12, 2015,
  3. Himanshu Sharma, “Geek Guide to Removing Referrer Spam in Google Analytics,” OptimizeSmart, accessed March 15, 2016,
  4. LunaMetrics, “About Regular Expressions,” Google Analytics Help, last updated March 8, 2008,
  5. “Event Tracking,” Google Developers, last updated March 3, 2016,
Junk referral filter, Google Analytics, University of Colorado Colorado Springs

Figure 1.1

Junk referral filter, Google Analytics, University of Colorado Colorado Springs

Resource link goal configurations, Google Analytics, University of Colorado Colorado Springs

Figure 1.2

Resource link goal configurations, Google Analytics, University of Colorado Colorado Springs


  • There are currently no refbacks.

Published by ALA TechSource, an imprint of the American Library Association.
Copyright Statement | ALA Privacy Policy