From 10e75c348cc5d52f418d3db28d1758e1e78eef31 Mon Sep 17 00:00:00 2001 From: Roman Shtylman Date: Sun, 24 Nov 2013 18:16:10 -0500 Subject: [PATCH] add google analytics code --- static/js/ga.js | 8 ++++++++ static/js/index.js | 3 +++ 2 files changed, 11 insertions(+) create mode 100644 static/js/ga.js diff --git a/static/js/ga.js b/static/js/ga.js new file mode 100644 index 0000000..89e4715 --- /dev/null +++ b/static/js/ga.js @@ -0,0 +1,8 @@ +// google analytics +(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-574889-7', 'localtunnel.me'); +ga('send', 'pageview'); diff --git a/static/js/index.js b/static/js/index.js index 64a81ed..bf4ebbe 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -34,3 +34,6 @@ socket.on('close', function () { request_counter.incrementTo(0); user_counter.incrementTo(0); }); + +// load google analytics after above starts +require('./ga');