Discovering Digital Library User Behavior with Google Analytics

  • Slides: 16
Download presentation
Discovering Digital Library User Behavior with Google Analytics Kirk Hess University of Illinois Urbana-Champaign

Discovering Digital Library User Behavior with Google Analytics Kirk Hess University of Illinois Urbana-Champaign Hi #code 4 lib!

Add Event Tracking Analyze Data Collect Data Export data using API

Add Event Tracking Analyze Data Collect Data Export data using API

Why Google Analytics? AWStats++ Urchin-- http: //google. com/analytics/ Java. Script-based Small tracking image (visible

Why Google Analytics? AWStats++ Urchin-- http: //google. com/analytics/ Java. Script-based Small tracking image (visible via Firebug) = mostly users not bots Works across domains Easy to integrate with existing systems Low cost API

Add Tracking Tracker Code j. Query: Event Injection

Add Tracking Tracker Code j. Query: Event Injection

Examples: Tracking code <script type="text/javascript"> var _gaq = _gaq || []; _gaq. push(['_set. Account',

Examples: Tracking code <script type="text/javascript"> var _gaq = _gaq || []; _gaq. push(['_set. Account', 'UA-XXXX-1']); _gaq. push(['_set. Allow. Linker', true]); _gaq. push(['_set. Domain. Name', 'illinoisharvest. grainger. uiuc. edu']); _gaq. push(['_set. Allow. Hash', false]); _gaq. push(['_track. Pageview']); (function() { var ga = document. create. Element('script'); ga. type = 'text/javascript'; ga. async = true; ga. src = ('https: ' == document. location. protocol ? 'https: //ssl' : 'http: //www') + '. googleanalytics. com/ga. js'; var s = document. get. Elements. By. Tag. Name('script')[0]; s. parent. Node. insert. Before(ga, s); })(); </script>

<script type="text/javascript"> if (typeof j. Query != 'undefined') { j. Query(document). ready(function($) { j.

<script type="text/javascript"> if (typeof j. Query != 'undefined') { j. Query(document). ready(function($) { j. Query: var filetypes = /. (pdf|txt|dijv|xml)$/i; Push event code on to any links var base. Href = ''; https: //github. com/kirkhess/Google-Analytics-Event-Analysis if (j. Query('base'). attr('href') != undefined) base. Href = j. Query('base'). attr('href'); j. Query('a'). each(function() { var href = j. Query(this). attr('href'); if (href && (href. match(/^https? : /i)) && (!href. match(document. domain))) { j. Query(this). click(function() { var ext. Link = href. replace(/^https? : ///i, ''); _gaq. push(['_link', href]); _gaq. push(['_track. Event', 'External', 'Click', ext. Link]); if (j. Query(this). attr('target') != undefined && j. Query(this). attr('target'). to. Lower. Case() != '_blank') { set. Timeout(function() { location. href = href; }, 200); return false; } }); } else if (href && href. match(filetypes)) { j. Query(this). click(function() { var extension = (/[. ]/. exec(href)) ? /[^. ]+$/. exec(href) : undefined; var file. Path = href; _gaq. push(['_track. Event', 'Download', 'Click-' + extension, file. Path]); if (j. Query(this). attr('target') != undefined && j. Query(this). attr('target'). to. Lower. Case() != '_blank') { set. Timeout(function() { location. href = base. Href + href; }, 200); return false; } }); }); } </script>

Collect Data A few months later…

Collect Data A few months later…

Google Analytics Interface • • Heat Map Content Drill Down Visitor Flow Events

Google Analytics Interface • • Heat Map Content Drill Down Visitor Flow Events

Chicago: Awful? Discuss

Chicago: Awful? Discuss

Export data using API • Google Analytics API • Java or Javascript • Export

Export data using API • Google Analytics API • Java or Javascript • Export any field into a database for further analysis

public class Google. Analytics. Ingest { // Credentials for Client Login Authorization. private static

public class Google. Analytics. Ingest { // Credentials for Client Login Authorization. private static final String CLIENT_USERNAME = "kirk. [email protected] com"; private static final String CLIENT_PASS = "zzzz"; // Table ID constant private static final String TABLE_ID = "ga: 12345678"; public static void main(String args[]) { try { // Service Object to work with the Google Analytics Data Export API. Analytics. Service analytics. Service = new Analytics. Service("ga. Export. API_acct. Sample_v 2. 0"); // Client Login Authorization. analytics. Service. set. User. Credentials(CLIENT_USERNAME, CLIENT_PASS); // Get data from the Account Feed. get. Account. Feed(analytics. Service); // Access the Data Feed if the Table Id has been set. if (!TABLE_ID. is. Empty()) { } // Get profile data from the Data Feed. get. Data. Feed(analytics. Service); . . .

Analyze Data • • Which items are popular? How many times was an item

Analyze Data • • Which items are popular? How many times was an item viewed? Downloaded? Effective Collection Size

19 th Century British Novels Collection: Events 2100 Most items are never used 1400

19 th Century British Novels Collection: Events 2100 Most items are never used 1400 700 0 7808

Next steps • Change site design • Change search weighting – Allow users to

Next steps • Change site design • Change search weighting – Allow users to sort by popularity – Recommender system • Add new tracking/new repositories • Analyze webstats

Code: https: //github. com/kirkhess/Google-Analytics-Event-Analysis

Code: https: //github. com/kirkhess/Google-Analytics-Event-Analysis