USING GOOGLE ANALYTICS IN THE CATALOG John Wohlers Waubonsee Community College Technologies Used • SirsiDynix E-Library • Google Analytics • JavaScript An Introduction to Google Analytics • Statistics and reporting tool • Geared towards marketing • AdWords/ AdSense • ROI • Goals • Campaigns • Replacement for BLUEcloud Analytics? Basic Analytics E-Library Setup • Step 1: Create Analytics account • http://www.google.com/analytics • One account handles multiple libraries / services • Account – Top level organization • Property – Branch, product, etc… • Step 2: Edit your environment file • ibistro.env or env##.env • GOOGLE_ANALYTICS • UA-XXXXX-YY • YY = Web Property ID index number This API has been replaced with a newer “Universal Analytics” API. • Step 3: Wait… Audience Overview • Sessions • Users • Pageviews • Pages/Session • Avg Session Duration • Bounce Rate • % New Sessions Technology Acquisition -> All Referrals Audience -> Geo -> Location Demographics and Interests • Privacy Issues? (DoubleClick) • Required Text https://support.google.com/analytics/answer/2700409 • Demographics • Age • Gender Demographics and Interests • Interests • Affinity Categories – Broad lifestyle categories • Movie Lovers, Technophiles, News Junkies & Avid Readers, TV Lovers • In-Market Segments - Specific product categories users are in the market for • Real Estate/Residential Properties/Residential Properties , Education/Post-Secondary Education, Home & Garden/Home Improvement, Financial Services/Tax Services • Other Categories – Specific content your users consume • Arts & Entertainment/TV & Video/Online Video, Reference/General Reference/Dictionaries & Encyclopedias, Books & Literature/Writers Resources, Jobs & Education/Education/Colleges & Universities • Collection Development? Programming? Enhancing Analytics With Custom Events, Metrics, and Dimensions • Why? • Track searches • Local vernacular searches • Collection development • Track feature usage • Catalog map • Book previews • Language • Track session timeouts Tips • Plan carefully • No editing of old data • Plan for growth • Event categories • Consistent naming conventions General Modifications • Replace SIRSI provided GA tracking code • Comment out, or remove GA code in copyright.h <SIRSI_Conditional IF Environ="GOOGLE_ANALYTICS^^ne"> <script type="text/javascript"> // var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); // document.write(unescape("%3Cscript src='" + gaJsHost + "googleanalytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> // try { // var pageTracker = _gat._getTracker('<SIRSI_Data Environ="GOOGLE_ANALYTICS">'); // pageTracker._trackPageview(); // } catch(err) {} </script> </SIRSI_Conditional> • Always copy files to pages_custom before editing! • [html_head.h] and [html_head_tabbed.h] General Modifications - <head> • Add Universal Analytics Code • Always copy files to pages_custom before editing! • [html_head.h] and [html_head_tabbed.h] <SIRSI_Conditional IF Environ="GOOGLE_ANALYTICS^^ne"> <!-- Google Analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '<SIRSI_Data Environ="GOOGLE_ANALYTICS">', 'auto'); ga('require', 'displayfeatures'); </script> <!-- End Google Analytics --> </SIRSI_Conditional> </head> Allows adding events and setting variables during loads using SIRSI tags General Modifications • [copyright.h] • Send pageview • Records basic pageview statistics <SIRSI_Conditional IF Environ="GOOGLE_ANALYTICS^^ne"> <script type="text/javascript"> <!-- Google Analytics --> //<![CDATA[ ga('send', 'pageview'); //]]> <!-- End Google Analytics --> </script> </SIRSI_Conditional> </body> </html> Event Tracking ga(‘send’,’event’,’’,’’,’’, 0); • Category (Required) • Enhancement, Direct Linking, Account • Action (Required) • Preview Item, View Map, Cite This, Change Language • Label (Optional) • Item Title • Value (Optional) • Records Returned Event Tracking (Example 1): Custom Enhancement • Track usage of custom enhancements • Book Preview • Item Location Map • Cite This • Persistent Link • View Current Content (RSS Feeds in Catalog) Event Tracking (Example 1): Code • JavaScript • Place “ga()” in event triggered code • Event • Category: “Catalog” • Action: “View Map” • Label: Library, using SIRSI_Data tag ga('send', 'event',‘Enhancement','View Map', '<SIRSI_Data List_DC="DX" NORTL CVTJS>'); • CVTJS is your friend • NORTL - Do not convert the text order, data is a policy • Remember the trailing single quote Event Tracking (Example 2): Language Change • Tracking User Preferences • Language Change • Change Display • Holdings Display • Catalog Display Event Tracking (Example 2): Code • Modify module_language_choices.h • Add onClick event • Event • Category: “User Prefs” • Action: “Change Language” • Label: Language, using eLibrary SIRSI_Data tag • <SIRSI_Data Session_List="LANG_DISP" NORTL CVTJS> • Session Variable: LANG_DISP <a onClick=“ga('send', 'event', ‘User Prefs’, 'Change Language', '<SIRSI_Data Session_List="LANG_DISP" NORTL CVTJS>');" href="<SIRSI_Data Session="WEBCAT_URL" NORTL>/<SIRSI_Data Session=SESSION NORTL>/111/<SIRSI_Data Session_List="LANG_POL" NORTL>" title="<SIRSI_Data Session_List="LANG_DISP">" target="_top"> Event Tracking (Example 3): Failed Searches • Searches • Failed • Successful • Metrics, a better option? Event Tracking (Example 3): Failed Searches • Modify 9.pg • Placed within the existing <SIRSI_Conditional IF DC_Comp="MN^50002^"> <SIRSI_Conditional IF Environ="GOOGLE_ANALYTICS^^ne"> <script type="text/javascript"> <!--//--><![CDATA[//><!-<SIRSI_Conditional IF DC_Comp="MN^456^" AND NOT Session="SRCH_TERM1^" AND NOT Session="SRCH_TERM1^"> ga('send', 'event', 'Search', 'Fail', '<SIRSI_Data Session="SRCH_LABEL1" CVTJS> <SIRSI_Data Session="SRCH_TERM1" CVTJS> <SIRSI_Data Session="SRCH_TERM2" CVTJS> <SIRSI_Data Session="SRCH_TERM3" CVTJS> <SIRSI_Data Session="SRCH_TERM4" CVTJS> …‘); </SIRSI_Conditional> //--><!]]> </script> </SIRSI_Conditional> Failed Searches During Spring Break Delving Deeper! • Dimensions and Metrics • Increased Flexibility • Advanced Custom Reporting • Still Learning • Be Gentle Dimensions and Metrics • Dimension • Descriptive attribute or characteristic of an object that can be given different values. • Example: Geographic location • Lattitude • Longitude • City Name • Example: Item • Material Type • Author • Publisher • Collection • Example: Search Term 1 – 8 • 20 Free / 200 Premium Dimensions and Metrics • Metrics • Individual elements of a dimension measured as a sum or a ratio • Example: City • Population • Example: Searches • Items Returned • Example: Item • Page Count • 20 Free / 200 Premium Creating Custom Dimensions and Metrics • https://support.google.com/analytics/answer/2709829 • Plan carefully • No editing of old data • Can be set for all activities on page • Only available in Custom reports and Segments Search Tracking (Example 1): Terms • Custom Dimensions: • Search Term 1 • Search Term 2 • Search Term 3 • Search Term 4 • Search Term 5 • Search Term 6 • Search Term 7 • Search Term 8 • Custom Metrics: • Number of Hits in Search Search Tracking (Example 1): Code var metricValue = '<SIRSI_Data Session="SRCH_PRIMARY_NUM_HITS" NORTL>'; ga('set', { 'dimension1' : '<SIRSI_Data Session="SRCH_LABEL1" CVTJS> - <SIRSI_Data Session="SRCH_TERM1" CVTJS>', 'dimension2' : '<SIRSI_Data Session="SRCH_LABEL2" CVTJS> - <SIRSI_Data Session="SRCH_TERM2" CVTJS>', 'dimension3' : '<SIRSI_Data Session="SRCH_LABEL3" CVTJS> - <SIRSI_Data Session="SRCH_TERM3" CVTJS>', 'dimension4' : '<SIRSI_Data Session="SRCH_LABEL4" CVTJS> - <SIRSI_Data Session="SRCH_TERM4" CVTJS>', 'dimension5' : '<SIRSI_Data Session="SRCH_LABEL5" CVTJS> - <SIRSI_Data Session="SRCH_TERM5" CVTJS>', 'dimension6' : '<SIRSI_Data Session="SRCH_LABEL6" CVTJS> - <SIRSI_Data Session="SRCH_TERM6" CVTJS>', 'dimension7' : '<SIRSI_Data Session="SRCH_LABEL7" CVTJS> - <SIRSI_Data Session="SRCH_TERM7" CVTJS>', 'dimension8' : '<SIRSI_Data Session="SRCH_LABEL8" CVTJS> - <SIRSI_Data Session="SRCH_TERM8" CVTJS>', 'metric1' : metricValue }); Search Tracking (Example 1): Report • Customization -> • New Custom Report -> • Add Dimension Search Tracking (Example 2): Authors • Custom Dimension • Author Search Tracking (Example 2): Code view_item_info.h <SIRSI_Conditional IF DC_Exists="IA"> <!-- Print the author, if one exists --> <SIRSI_Data DC="IA"><br/> <!-- Google Analytics --> <script type="text/javascript"> <!--//-><![CDATA[//><!-ga('set', 'dimension9', '<SIRSI_Data DC="IA" CVTJS>'); //--><!]]></script> <!-- End Google Analytics --> </SIRSI_Conditional> Search Tracking (Example 2): Report • Authors of Viewed Items – Month of April • Saul Austerlitz - Sitcom : a history in 24 episodes from I love Lucy to Community • Nannette Commander - Chart your success on the COMPASS test Fun Results • 16 searches for “Obsessive Compulsive Disorder” in only two separate sessions. • “Drinking age 18”, “Mental Institutions”, and “Prison” were among the most searched items during spring break. Resources • Getting Started Guide • http://www.google.com/analytics/learn/setupchecklist.html • Google Analytics • Jerri L. Ledford, Mary E. Tyler, Joe Teixeira • ISBN-13: 9780470531280 Questions? • Email: jwohlers@waubonsee.edu • Twitter: cap60552 • Facebook: http://www.facebook.com/wohlers • In person at the conference Why type it… Contact Info