45
Google Analytics and Primo Scott Hanrath University of Kansas Libraries @rshanrath | [email protected]

Using Google Analytics with Primo

Embed Size (px)

Citation preview

Page 1: Using Google Analytics with Primo

Google Analytics and Primo

Scott Hanrath

University of Kansas Libraries

@rshanrath | [email protected]

Page 2: Using Google Analytics with Primo

Analytics and Discovery

Page 3: Using Google Analytics with Primo

Analytics and Discovery

“…understanding and

optimizing…usage”

Page 4: Using Google Analytics with Primo

Analytics and Discovery

Page 5: Using Google Analytics with Primo

Image: National Archives http://research.archives.gov/description/514671

Page 6: Using Google Analytics with Primo
Page 7: Using Google Analytics with Primo
Page 8: Using Google Analytics with Primo
Page 9: Using Google Analytics with Primo

Implementing Google Analytics

Page 10: Using Google Analytics with Primo

Implementing Google Analytics

Page 11: Using Google Analytics with Primo

Implementing Google Analytics

Page 12: Using Google Analytics with Primo

Event Tracking

“That* Just Happened!”

* Where ‘That’ is a user interaction with, or features of the page that you can intercept via a JavaScript function and parse into an Event you can describe back to Google Analytics.

Page 13: Using Google Analytics with Primo

Event Tracking - Code

ga('send', 'event',

'category', 'action’,

'label’, value);

Category

- - Action

- - - - Label

Page 14: Using Google Analytics with Primo

Event Tracking - Example

$(‘a’).on(‘click’, function(){

ga(‘send’, ‘event’, ‘link-click’,

$(this).text());

});

Category: ‘link-click’

Action: [the text of the link]

Page 15: Using Google Analytics with Primo

Event Tracking – Item Tabs

Page 16: Using Google Analytics with Primo

Event Tracking – Item Tabs

$('.EXLResultTab a').on(‘click’,

function(){

var text = $(this).text();

ga('send', 'event', 'Item Tab', text);

}

);

Page 17: Using Google Analytics with Primo

Event Tracking – Item Tabs

Page 18: Using Google Analytics with Primo

Event Tracking – Item Tabs

Page 19: Using Google Analytics with Primo

Event Tracking – Item Tabs

$('.EXLResultTab a').on(‘click’,

function(){

var text = $(this).text();

var type = $(this).parents('tr')

.find('.EXLThumbnailCaption')

.text();

ga('send', 'event', 'Item Tab', text,

type);

}

);

Page 20: Using Google Analytics with Primo

Event Tracking – Item Tabs

Page 21: Using Google Analytics with Primo

Event Tracking – PNX Interactions

Page 22: Using Google Analytics with Primo

Event Tracking – Applied Facets

Page 23: Using Google Analytics with Primo

Event Tracking – Applied Facets

$('.EXLRefinementRibbonWithExclude .EXLRemoveRefinement').each(

function(){

var container = $(this);

var facet = $.trim(container.contents().filter(

function(){return this.nodeType == 3})[0].nodeValue

);

facet = facet.substr(0, facet.length - 1);

container.find('a').each(function(){

var value = $.trim($(this).text());

if ($(this).hasClass('EXLExcludedElement')){

value = '-'+value;

}

ga('send', 'event', 'Facet Applied', facet, value);

});

}

);

Page 24: Using Google Analytics with Primo

Event Tracking – Applied Facets

Page 25: Using Google Analytics with Primo

Event Tracking – Availability Clicks

Page 26: Using Google Analytics with Primo

Even Tracking – Availability Clicks

Page 27: Using Google Analytics with Primo

Event Tracking – Availability Clicks

Page 28: Using Google Analytics with Primo

Event Tracking - Searches

Page 29: Using Google Analytics with Primo

Event Tracking – Boolean Suggest

Page 30: Using Google Analytics with Primo

Event Tracking—Autocomplete

Page 31: Using Google Analytics with Primo

Event Tracking—Segments

Page 32: Using Google Analytics with Primo

Result Title Clicks per Session

Autosuggest 4.9

Facet Applied 3.5

Advanced Search Any Fields 2.9

Page 33: Using Google Analytics with Primo

Custom Dimensions

https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets

Page 34: Using Google Analytics with Primo

Custom Dimensions

Metric, e.g, Pageviews

Metric, e.g., Event Count

Dimension, e.g., Page Title

X X

Dimension, e.g., Event Category

X X

Metric: value of a thing that happened

Dimension: way to group those things

Page 35: Using Google Analytics with Primo

Custom Dimensions – Set up

• Define in Google Analytics Admin for Property

– Up to 20

– Defined by index, e.g, dimension1, dimension2

• Add JavaScript to set:

ga('set', 'dimension1', ’Foo');

Page 36: Using Google Analytics with Primo

Custom Dimensions—Scopes

• Hit – value is applied to the single hit for which it has been set.

• Session – value is applied to all hits in a single session.

• User – value is applied to all hits in current and future sessions, until value changes or custom dimension is made inactive.

From https://developers.google.com/analytics/devguides/platform/customdimsmets

Page 37: Using Google Analytics with Primo

Custom Dimensions—Page Type

• Define dimension with “hit” scope

• Determine which part of Primo is being used (e.g., Basic Search, My Account) by examining the URL with JavaScript– window.location.href

• Set custom dimension before sending page view

Page 38: Using Google Analytics with Primo

Custom Dimensions—Page Type

Page 39: Using Google Analytics with Primo

Custom Dimensions—Borrower Group

• Use Voyager’s Borrower Group for signed in users to create a Custom Dimension

• User scoped Dimension (applies to future sessions too)

• Custom Tile in the Views Wizard Layout Editor

Page 40: Using Google Analytics with Primo

<%@ page import="com.exlibris.primo.utils.SessionUtils" %>

<%@ page import="com.exlibris.primo.pds.PdsUserInfo"%>

<%

boolean logged_in = false;

try {

logged_in = SessionUtils.getIsLoggedIn(request);

} catch(Exception e) {}

%>

<script type="text/javascript">

function addGaUserDimensions(){

<%

PdsUserInfo userInfo = SessionUtils.getUserInfo(request);

if (logged_in && userInfo != null){

%>

ga('set', 'dimension2', '<%= userInfo.getBorGroup() %>');

<%

}

%>

}

</script>

Page 41: Using Google Analytics with Primo

Custom Dimensions—Borrower Group

Page 42: Using Google Analytics with Primo

Custom Dimensions—Borrower Group

Page 43: Using Google Analytics with Primo

Custom Dimensions—Borrower Group

Page 44: Using Google Analytics with Primo

Privacy

• Google Analytics IP Anonymization

ga('set', 'anonymizeIp', true);

• Alternatives

– Piwik (piwik.org)

Page 45: Using Google Analytics with Primo

Scott Hanrath

University of Kansas Libraries

@rshanrath | [email protected]