using google analytics with primo
TRANSCRIPT
![Page 1: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/1.jpg)
Google Analytics and Primo
Scott Hanrath
University of Kansas Libraries
@rshanrath | [email protected]
![Page 2: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/2.jpg)
Analytics and Discovery
![Page 3: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/3.jpg)
Analytics and Discovery
“…understanding and
optimizing…usage”
![Page 4: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/4.jpg)
Analytics and Discovery
![Page 5: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/5.jpg)
Image: National Archives http://research.archives.gov/description/514671
![Page 6: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/6.jpg)
![Page 7: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/7.jpg)
![Page 8: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/8.jpg)
![Page 9: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/9.jpg)
Implementing Google Analytics
![Page 10: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/10.jpg)
Implementing Google Analytics
![Page 11: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/11.jpg)
Implementing Google Analytics
![Page 12: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/12.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/13.jpg)
Event Tracking - Code
ga('send', 'event',
'category', 'action’,
'label’, value);
Category
- - Action
- - - - Label
![Page 14: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/14.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/15.jpg)
Event Tracking – Item Tabs
![Page 16: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/16.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/17.jpg)
Event Tracking – Item Tabs
![Page 18: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/18.jpg)
Event Tracking – Item Tabs
![Page 19: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/19.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/20.jpg)
Event Tracking – Item Tabs
![Page 21: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/21.jpg)
Event Tracking – PNX Interactions
![Page 22: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/22.jpg)
Event Tracking – Applied Facets
![Page 23: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/23.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/24.jpg)
Event Tracking – Applied Facets
![Page 25: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/25.jpg)
Event Tracking – Availability Clicks
![Page 26: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/26.jpg)
Even Tracking – Availability Clicks
![Page 27: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/27.jpg)
Event Tracking – Availability Clicks
![Page 28: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/28.jpg)
Event Tracking - Searches
![Page 29: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/29.jpg)
Event Tracking – Boolean Suggest
![Page 30: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/30.jpg)
Event Tracking—Autocomplete
![Page 31: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/31.jpg)
Event Tracking—Segments
![Page 32: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/32.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/33.jpg)
Custom Dimensions
https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
![Page 34: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/34.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/35.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/36.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/37.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/38.jpg)
Custom Dimensions—Page Type
![Page 39: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/39.jpg)
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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/40.jpg)
<%@ 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](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/41.jpg)
Custom Dimensions—Borrower Group
![Page 42: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/42.jpg)
Custom Dimensions—Borrower Group
![Page 43: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/43.jpg)
Custom Dimensions—Borrower Group
![Page 44: Using Google Analytics with Primo](https://reader031.vdocuments.mx/reader031/viewer/2022032218/55aab4501a28abe05b8b484f/html5/thumbnails/44.jpg)
Privacy
• Google Analytics IP Anonymization
ga('set', 'anonymizeIp', true);
• Alternatives
– Piwik (piwik.org)