From 2c184db805715c3c00b46d630cc2b3bdd289e4b5 Mon Sep 17 00:00:00 2001 From: BorisLevitskiy Date: Thu, 9 Apr 2015 18:36:17 +0300 Subject: [PATCH] Implemented embed of analytics during build --- Gruntfile.js | 20 ++++++++++++++------ src/index.html | 3 +++ src/js/analytics.js | 7 +++++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/js/analytics.js diff --git a/Gruntfile.js b/Gruntfile.js index 53d32c3..1f01d6e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -39,12 +39,20 @@ module.exports = function(grunt) { } }, copy: { - files: { - src: 'src/*.*', - dest: 'build/', - flatten: true, - expand: true + main: { + files: [{ + src: 'src/*.*', + dest: 'build/', + flatten: true, + expand: true + }, { + src: 'src/js/analytics.js', + dest:'build/js/', + flatten: true, + expand: true + }] } + }, processhtml: { build: { @@ -53,7 +61,7 @@ module.exports = function(grunt) { } } }, - clean: ['/build'] + clean: ['build/**'] }); // Load the plugin that provides the "uglify" task. diff --git a/src/index.html b/src/index.html index 2bfd2ae..33acbfc 100644 --- a/src/index.html +++ b/src/index.html @@ -35,6 +35,9 @@ + + + diff --git a/src/js/analytics.js b/src/js/analytics.js new file mode 100644 index 0000000..20f59af --- /dev/null +++ b/src/js/analytics.js @@ -0,0 +1,7 @@ +(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-61569164-1', 'auto'); +ga('send', 'pageview');