Add Google Analytics

This commit is contained in:
Ray Schamp 2015-05-14 14:31:54 -04:00
parent d6bfd1bf51
commit 2c0c8f2993
2 changed files with 10 additions and 2 deletions

View file

@ -271,6 +271,14 @@
</section>
</dialog>
</script>
<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', 'UA-30688952-3', 'auto');
ga('send', 'pageview', 'home');
</script>
<script type="text/javascript" src="libs/base64ab.js" async></script>
<script type="text/javascript" src="libs/swfobject.js"></script>
<script type="text/javascript" src="libs/jquery-1.11.2.min.js"></script>

View file

@ -286,7 +286,6 @@ function showPage(path, force) {
if it's hidden.
If we are linking to an anchor within a page, then show its parent.
*/
var toHide = "body > main, body > main > article";
var toShow = "#" + path;
var $toShow = $(toShow);
@ -309,9 +308,10 @@ function showPage(path, force) {
if (document.location.hash.substr(1) != path) document.location.hash = path;
$toShow[0].scrollIntoView(true);
$(document).trigger("page:show");
$(document).trigger("page:show", path);
}
$(document).on("page:show", function(e, page){ga("send", "pageview", page)});
/* URL Shortening */
function shorten(url, done) {