Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add google analytics

  • Loading branch information...
commit d09c4419e2f3e29af3607ecee1e226ff39fe1909 1 parent 5bc1910
Brandon Aaron authored
Showing with 31 additions and 1 deletion.
  1. +13 −0 _js/app.js
  2. +2 −0  _js/jqtouch.js
  3. +1 −1  cache.manifest
  4. +15 −0 index.html
13 _js/app.js
View
@@ -23,6 +23,7 @@ $(function(){
return;
}
+ // look for updates and notify the user
window.applicationCache.addEventListener('downloading', function() {
$('#jqt').addClass('downloadingupdate');
}, false);
@@ -34,6 +35,7 @@ $(function(){
}, false);
jqtouch.checkForUpdates();
+ // hook up the search form
$('#home').find('form').bind('submit', function(event) {
var $input = $('input', this),
val = $('input', this).val();
@@ -44,6 +46,7 @@ $(function(){
return false;
});
+ // handle the main navigation between categories and entries
$('a').live('tap click', function(event) {
var $this = $(this);
if ($this.is('.entry')) {
@@ -63,8 +66,18 @@ $(function(){
}
});
+ // make the initial pages scrollable
$('#jqt').find('.scrollable').scrollable();
+ // track events
+ $(document.body).bind('addPageToHistory', function(event, id) {
+ var page = $('#'+id),
+ title = page.find('h1').text(),
+ action = id === 'search' ? 'search' : 'show';
+ _gaq.push(['_trackEvent', 'browse', action, title]);
+ });
+
+ // get the docs
window.apiDocs = new APIDocs();
apiDocs.getXML({
success: function() {
2  _js/jqtouch.js
View
@@ -233,6 +233,8 @@
function addPageToHistory(page, animation, reverse) {
// Grab some info
var pageId = page.attr('id');
+ // MODIFIED: Trigger event
+ $body.trigger('addPageToHistory', pageId);
// Prepend info to page history
hist.unshift({
page: page,
2  cache.manifest
View
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# Rev 12
+# Rev 13
index.html
mt.png
15 index.html
View
@@ -145,5 +145,20 @@
</div>
</div>
</script>
+ <script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-541795-3']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script');
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
+ 'http://www') + '.google-analytics.com/ga.js';
+ ga.setAttribute('async', 'true');
+ document.documentElement.firstChild.appendChild(ga);
+ })();
+
+ </script>
</body>
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.