ltr: Vol. 49 Issue 4: p. 9
Chapter 2: Implementing Google Analytics on Different Platforms
Tabatha Farney
Nina McHale

Abstract

Installing Google Analytics is the first step, but most libraries have more than a single website—think library website, catalog, blog, and other online tools—that they maintain. Chapter 2 of Library Technology Reports (vol. 49, no. 4) “Maximizing Google Analytics: Six High-Impact Practices” provides an overview of the basic implementation process and recommends that libraries should track all their websites using Google Analytics. Learn how to install the tool on various library-specific platforms in order to track your library’s entire web presence.


How Does It Work?

The first generation of web analytics tools, available at the dawn of the Internet, were not hosted third-party products like Google Analytics, but software that was usually installed locally on the web server. There were (and still are) many open source or freely available tools, called log file analyzers. These tools can output a great deal of information about website activity, but it is not necessarily user-centric, actionable information, and it tends to reflect more intelligence about how the web server is performing than about what visitors are doing on a site. Information about visits and visitors—how the website and its content are being used by real people, rather than how many files the server is spitting out in a given time period—can be teased out, but not always quickly or easily. Finally, installing, configuring, and updating this type of software locally is not an insignificant undertaking, especially in libraries where IT resources are all too often stretched thin.

Enter the second generation of web analytics tools, which includes Google Analytics. Rather than analyzing log files, Google Analytics uses a dozen-line-long snippet of JavaScript (also known as the tracking code), placed invisibly into web pages, to send information about visits and visitors on your website to Google’s data center. The data center processes the information sent by the JavaScript snippet and returns numbers that can be massaged into interesting, actionable information—not just “hits”—in a user-friendly dashboard on the Google Analytics site. You don’t even need access to the website after the initial installation to have access to the data! Once you place the tracking code in your web pages, no regular technical maintenance (other than keeping pace with the speed of Google Analytics improvements) is required. With this dashboard, you can slice and dice your web analytics data in hundreds of ways, and the data can be presented in user-friendly report formats—all of which will be covered in depth in the chapters of this report.

Google Analytics

www.google.com/analytics

Here’s what this magical snippet of JavaScript looks like:



In the actual snippet that Google Analytics provides after an account is created, the Xs in UA-XXXXXXX-X will be replaced with numbers unique to your profile; this is your Google Analytics web property ID. Implementation is a two-step process: first, you create your account on the Google Analytics website; second, you add the tracking code generated by Google Analytics to the websites you wish to track.


Creating a Google Analytics Account

Using Google Analytics requires a Google (but not necessarily a Gmail) account. You can use an existing one or create a new one; consider also creating a shared administrator account for your team, department, or organization that is separate from anyone’s personal account in case the person owning the account leaves your department or organization.

Any step-by-step sign-up documentation we could produce here would become dated quickly, as Google Analytics is under constant development. The process is quite simple, though; simply point a web browser to google.com and follow the on-screen instructions. At the end of the process, you will have access to your JavaScript code snippet, including the web property ID. When you access your data and create reports, profiles, etc., all of the reporting and data manipulation will take place on the Google Analytics site.


Concepts to Know

While the account creation process is simple, there are a few terms to be familiar with as you start to use Google Analytics:

  • Account. A single Google Analytics account can be used to track and report activity for multiple websites. Accounts can contain one or more properties and can have multiple users.
  • Property. A property—by default, a single domain, e.g., yourlibrary.org—is associated with and identified by its web property ID. For example, you may have a property for your library’s website, your catalog, and any other separately hosted web products (more on tracking multiple domains in chapter 3). Properties can contain one or more profiles.
  • Profile. Up to fifty profiles may be assigned to a single Google Analytics account. Think of profiles as predefined views of your data; they can be used to set up filters and goals to measure different aspects of use of your site. For example, you may have one profile that tracks only mobile visits to your site. One profile is assigned to each property by default, and a master profile should be set up for each property for default data collection. What you decide to do with profiles, including how many you will have, will depend upon your overall goals and data needs for your site.
  • Users. There are two permissions roles in Google Analytics, administrators and users. The person who creates the account is, by default, an administrator. You may wish to add colleagues to one or the other of these roles; note that administrators have access to all statistics and will be able to add filters and goals and add and delete properties, so assign this powerful role with care. Users can access reports, create custom reports, and configure alerts and scheduled e-mails in the profiles assigned to them.


Adding Google Analytics Tracking Code to Popular Web-Based Library Tools
Does the Tracking Code Go before <∕head≯ or <∕body≯?

If you've already been using Google Analytics for a while, you may remember that the official documentation used to dictate that the JavaScript snippet be placed before the closing body tag (<∕body≯). Prior to December 2009, Google recommended this placement because the script could potentially slow down the load time for content in the body of the page, meaning that your users would have to wait longer to view the content of the page—obviously undesirable. However, in December 2009, Google introduced a new asynchronous tracking code snippet that circumvents this potential load-time problem. Further, the benefit of putting code near the top of the page is that it will capture data from those impatient users who don't wait for a page to fully load before clicking a link and moving on to the next page.1

If you haven't updated your tracking code since December 1, 2009, we highly recommend that you do so by copying and pasting the new asynchronous code from your Google Analytics administration dashboard. Also, if the tracking code for your site is still located before the closing body tag (<∕body≯) on the pages in your site, go ahead and move it up to before the closing head tag (<∕head≯), but make sure it is the asynchronous code so that you don't encounter any load-time issues.

If for some reason it proves too difficult to replace or move your snippet, you can continue to collect analytics data with the tracking code at the bottom of the page; there is nothing technologically wrong with that approach. It is simply best practice, and therefore providing the most accurate data, to use the newer asynchronous code, placed just before the <∕head≯ tag in your web pages. Again, just make sure not to put the “traditional” (i.e., non-asynchronous) tracking code in the header.

With any vendor product, the general approach to adding the tracking code should be determining if there is an automatic means of inserting the code into the head section of every web page as close to the closing <∕head≯ tag as possible. For older sites that are not contained in any web content management system or product, the code snippet will need to be added to every page that you wish to track. If this proves impractical on legacy sites, even tracking only the home page will provide some insight into how the site is being used.

The rest of this chapter is a quick and easy read—in fact, you don’t even need to read all of it. Simply find the platforms you’re using, and follow the directions for adding the tracking code. Before you add tracking code to each and every site you wish to track, however, you may wish to read chapter 3 for tips about how to combine statistics from multiple sites into one place. If you don’t have administrative access to any of the platforms listed below, yet you’re the one in charge of statistics, contact the system administrator (e.g., webmaster/web team, ILS coordinator) or anyone else who has the highest level of access to the tools you wish to track.


Web Development Software and Content Management Systems (CMSs)

On static library web pages, the JavaScript tracking code will need to be placed in each and every page that you wish to track. If your site uses any kind of template, it’s obviously desirable to place the code in the template, when possible, and add it to the entire site via a template update. With robust content management systems (CMSs) like WordPress and Drupal, simple modifications to the core software (variously called plugins, modules, extensions, etc.) make applying the tracking code systematically across the entire site quick and painless. For many library vendor web platforms, all that is required is contacting the technical support service and providing the web property ID. While this is convenient, vendors may still place the code before the <∕body≯ tag, and any customization of code (which will be discussed in depth in chapter 3) may not be possible.

While the best effort was made to compile the most up-to-date information at the time of publication, products are continually updated and improved, so when in doubt, contact your vendor or consult official product documentation. The information below was compiled from vendor customer support, product websites and official online documentation, posts from trustworthy technology blogs, and e-mail conversations with library web staff with experience implementing Google Analytics on the various platforms.

Adobe Dreamweaver/Contribute

For Dreamweaver and Contribute sites, site administrators (or anyone with write access to all of the site’s files) can insert tracking code into the .dwt template files. Place the tracking code just before the closing head tag (<∕head≯) in the .dwt file. If your site uses multiple .dwt files, be sure to add the tracking code to each one.

WordPress
Plugin Method

There are a number of plugins that integrate Google Analytics into WordPress sites, including these:

  • Google Analytics for WordPress
  • GA Google Analytics
  • Google Analyticator

Google Analytics for WordPress

http://wordpress.org/extend/plugins/google-analytics-for-wordpress

GA Google Analytics

http://perishablepress.com/google-analytics-plugin

Google Analyticator

http://wordpress.org/extend/plugins/google-analyticator

Choose a plugin that is well-supported and meets your requirements. Most plugins can be added to a WordPress site using the built-in installer, but some may require manual installation. For more information, see “Installing Plugins” in the WordPress.org Codex.

WordPress.org Codex: Installing Plugins

http://codex.wordpress.org/Managing_Plugins#Installing_Plugins

Template Method

Without adding a plugin, you may add the Google Analytics tracking code to the footer.php file, but note that it will be placed before the <∕body≯ tag rather than the <∕head≯ tag. Another alternative is to add it to the functions.php file.

Drupal
Contributed Module Method

There are several Drupal modules in active development for versions 6 and 7 that allow for easy Google Analytics integration, but the most basic module is named Google Analytics.

Drupal: Google Analytics

http://drupal.org/project/google_analytics

If you would like to customize it further, look for currently maintained modules on the Drupal website that fit your needs and use cases. Note that event tracking (see chapter 5 for more information) is supported in a separate module, Google Analytics Event Tracking.

Drupal: Google Analytics Event Tracking

http://drupal.org/project/google_analytics_et

The exact implementation procedures and available features vary by module, but the general process will be to upload, install, and enable the Drupal module to your site and configure the module by adding to it your web property ID for the tracking tool. See the project pages and readme.txt files included with the module download for more information regarding proper installation and configuration.

Template File Method

While we recommend using the module method for tracking Drupal sites, it is also possible to add the JavaScript to Drupal sites by embedding it directly in site template files (i.e., page.tpl.php) prior to the <∕head≯ tag. This method requires write access to site template files and at least minimal knowledge of PHP. If you are using a contributed theme, this method will require re-addition of the tracking code each time the site theme is updated—hence the module method is strongly recommended. If multiple template files are used, be sure to add the code so that it appears exactly once on every page on the site.

MediaWiki

A MediaWiki Google Analytics extension is available online. MediaWiki extensions must be downloaded, extracted, and then uploaded into the /extensions/ directory and activated in the LocalSettings.php configuration file. See the MediaWiki Manual pages on extensions for complete information about extending MediaWiki.

MediaWiki: Extension: Google Analytics

www.mediawiki.org/wiki/Extension:Google_Analytics_Integration

MediaWiki: Manual: Extensions

www.mediawiki.org/wiki/Manual:Extensions

Joomla!

There are several extensions to integrate Google Analytics into Joomla!-based sites available at the Joomla! Extensions Directory under the category Site Management—Analytics—Site Analytics—Google-Based. Look for a currently updated, highly reviewed plugin that suits your analytics needs and supports the asynchronous tracking code. For example, Asynchronous Google Analytics Plugin is notable in that it follows current best practices by placing the up-to-date tracking code in the document head.

Joomla! Extensions Directory

http://extensions.joomla.org

Joomla! extensions must be downloaded from the Web, then uploaded, via the administrative back end or manually with FTP software, and enabled on the website. For more information about extending Joomla!, see the official documentation on installing an extension.

Joomla! Documentation: Installing an Extension

http://docs.joomla.org/Installing_an_extension

Omeka

The simplest way to add Google Analytics to Omeka-based sites is to use the plugin GoogleAnalytics available for Omeka. Enable the plugin from the Settings panel, and then click Configure to add the web property ID.

Omeka GoogleAnalytics Plugin

http://omeka.org/codex/Plugins/GoogleAnalytics


Online Catalogs (OPACs) of Integrated Library Systems (ILSs)
Evergreen

For Evergreen, edit the config.tt2 file in the template and enable it by setting the value of google_analytics.enabled to True and change the value of google_analytics.code to be the web property ID.

Evergreen: Including External Content to Your Public Interface

http://docs.evergreen-ils.org/2.3/_including_external_content_to_you_public_interface.html

Koha

For Koha, add the Google Analytics tracking code to the opacuserjs system preference.

ByWater Solutions: Koha Web Stats Using Google Analytics

http://bywatersolutions.com/2013/01/17/koha-google-analytics

Koha 3.8 Manual: 1.11.1.36. opacuserjs

http://manual.koha-community.org/3.8/en/administration.html#opacuserjs

Millennium, Innovative Interfaces Incorporated (III)

For Millennium, common practice has been to add the tracking code to the botlogo.html file, which is included in the bottom of all of the WebOPAC files. This places the code snippet before the <∕body≯ tag.

A second option using the INSERTTAG_INHEAD web option would place the code snippet in the head of all OPAC pages and adhere to current Google Analytics best practices. See CSDirect document 106891, “General Display and Behavior Options.”

Polaris

Support for Google Analytics is integrated into the Polaris System Administration subsystem; simply enter the Google Analytics web property ID via the administrative interface.

SirsiDynix (Horizon, Symphony, Unicorn)

Google Analytics support is integrated in many of SirsiDynix’s products. Simply add your Google Analytics account information from the administrative interface. Consult the official documentation, or contact support with questions or problems.

TLC

Technical support at TLC will add a Google Analytics web property ID to LS2 PAC, which provides the public-facing OPAC for all three of TLC’s integrated library systems. Installation does not include the Google Analytics asynchronous JavaScript, and it is placed before the <∕body≯ tag. No further support for Google Analytics is offered beyond basic installation.

WebVoyáge

For classic WebVoyáge, add the full tracking code snippet in this file: /m1/voyager/xxxxdb/etc/webvoyage/header.htm.

For Tomcat, refer to Procedure 18.1, “Add Tracking Codes,” in Voyager 7.2: WebVoyáge Architecture Overview and Configuration Models.

Voyager 7.2: WebVoyáge Architecture Overview and Configuration Models

www.exlibrisgroup.org/download/attachments/32408241/Webvoyage_Arch_7+2.pdf


Discovery Layer Tools
Bibliocommons

For Bibliocommons, customer support adds the web property ID to implement tracking.

EBSCO Discover Service (EDS)

For EBSCO Discover Service, tracking code for analytics tools may be inserted in a custom footer created in the administrative interface. In the administrative panel, select Customize Services, then Branding, then Bottom Branding.

Encore, Innovative Interfaces Incorporated (III)

For Encore, open a ticket with the III help desk that includes your Google Analytics web property ID, and III will add the tracking code for you.

Primo

For Primo, add the Google Analytics–generated code to a custom header (i.e., NOT in the default header, html, which will be overwritten during upgrades).

SirsiDynix Enterprise

Google Analytics support is integrated in many of SirsiDynix’s products. Simply add your Google Analytics account information from the administrative interface. Consult the official documentation, or contact support with questions or problems.

Summon, Serials Solutions

For Summon, add the Google Analytics web property ID via the administration console.

VuFind

For VuFind, tracking code may be added to the theme layout.tpl file, found in /web/interface/themes/[your-theme-name]/layout.tpl. For mobile VuFind themes, add the snippet to its layout.tpl file as well (/web/interface/themes/mobile/layout.tpl).

WorldCat Local

It is not currently possible to use Google Analytics with WorldCat Local, but compatibility with Google Analytics is on OCLC’s feature roadmap.


Institutional Repository (IR) Software
BePress DigitalCommons

Google Analytics is integrated into DigitalCommons, so add your web property ID, but note that the tracking code is the traditional code and placed before the <∕body≯ tag.

ContentDM

For ContentDM, add the tracking code via the Custom Pages/Scripts configuration option.

ContentDM Online Help: Custom Pages/Scripts

www.contentdm.org/help6/custom/configure11.asp

DSpace

For the DSpace XML User Interface, add the web property ID to the dspace.cfg parameter xmlui.google.analytics.key.

For the JSP User Interface (release 3.0), add your web property ID to the jspui.google.analytics.keyparameter.


Other Library Vendor Products
LibGuides

LibGuides offers two options in its system settings for adding the Google Analytics tracking code: the Custom Analytics Code box found under the general settings, and the Custom JS/CSS Code box in the Look & Feel area. Note the Custom Analytics Code box puts the tracking code close to the end of the <body≯ section, while the Custom JS/CSS Code option adds it to the <head≯ section, which is the recommended way of adding the code.

Statistics in LibGuides & LibGuides CMS: More Options?

http://help.springshare.com/lgstats/moreoptions

Bookletters

For Bookletters, add the tracking code to the customizable page templates.

Evanced (Room Reserve and Event Calendar)

If Evanced hosts your instance of Room Reserve or Event Calendar, e-mail customer support (support@evancedsolutions.com) to have your Google Analytics tracking code added.

If you host your own instance of Room Reserve or Events, locate the defines.inc file, which is usually in the common folder in the web root, i.e., \inetpub\wwwroot\libraryname\lib or \inetpub\wwwroot\evanced\lib. Make a backup copy of the file before editing, and then copy the Google Analytics–generated code under “Common Header Routine for Patron Pages,” between <body≯ and <div id=″header″≯. See the online documentation for installation details.

Evanced: Adding Google Analytics to the Event Calendar and Room Request public pages

http://kb.evanced.info/article.php?id=310

AirPAC, Innovative Interfaces Incorporated (III)

For AirPAC, open a ticket with customer support that includes your Google Analytics web property ID, and III will add the tracking code for you.


Conclusion

You might be thinking, “I get statistics directly from the product itself; why would I want to track in Google Analytics as well? Isn’t that just duplicating my statistics-gathering efforts?” Chances are that the native statistics interfaces on any single product do not provide the same breadth and depth of information as Google Analytics. Further, as will be revealed in chapter 3, Google Analytics can combine data from multiple websites to provide a more comprehensive and accurate report of the total library user experience. So, while you can certainly use native statistics interfaces, the depth of information that Google Analytics provides, in addition to its robust reporting capabilities, will take you further in your analytics adventure.


Additional Resources

References
1. Sharif, Sayf. , . “Where Should the Google Analytics Tracking Code Be Placed?” LunaMetrics blog, Feb. 9, 2012, www.lunametrics.com/blog/2012/02/09/where-put-google-tracking-code

Article Categories:
  • Information Science
  • Library Science

Refbacks

  • There are currently no refbacks.


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