Created
September 14, 2012 02:36
-
-
Save jasonclark/3719474 to your computer and use it in GitHub Desktop.
How to add Google Analytics to jQuery Mobile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Mobile @ Your Library</title> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /> | |
<link rel="stylesheet" href="./meta/styles/m.css" /> | |
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> | |
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script> | |
<!--<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-XXXXXXXX-XX']); | |
_gaq.push(['_gat._anonymizeIp']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); | |
</script>--> | |
<body> | |
<!-- Start of home page --> | |
<div data-role="page" id="home" data-theme="d"> | |
<div data-role="header" data-theme="d"> | |
<h1>Mobile @ Your Library</h1> | |
<a href="#home" data-icon="home" data-iconpos="notext" data-theme="d" class="ui-btn-right">home</a> | |
</div><!-- /header --> | |
<div data-role="content"> | |
<ul data-role="listview" data-inset="true"> | |
<li><a href="#search">Search</a></li> | |
<li><a href="#hours">Hours</a></li> | |
<li><a href="#ask">Ask a Librarian</a></li> | |
<li><a href="#about">About</a></li> | |
<li><a href="#where" data-rel="dialog" data-transition="pop">Where</a></li> | |
</ul> | |
</div><!-- /content --> | |
<div data-role="footer" data-id="myfooter" data-position="fixed" data-theme="d"> | |
<div class="controls" data-role="controlgroup" data-type="horizontal"> | |
<a href="#home" data-role="button" data-icon="home">Home</a> | |
<a href="#search" data-role="button" data-icon="search">Search</a> | |
<a href="#ask" data-role="button" data-icon="info">Ask</a> | |
<a href="/index.php" rel="external" data-role="button" data-icon="plus">Full site</a> | |
</div> | |
</div><!-- /footer --> | |
</div><!-- /page --> | |
<!--<script type="text/javascript"> | |
$('[data-role=page]').live('pageshow', function (event, ui) { | |
try { | |
_gaq.push( ['_trackPageview', event.target.id] ); | |
console.log(event.target.id); | |
} catch(err) { | |
} | |
}); | |
</script>--> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment