Implemented embed of analytics during build

This commit is contained in:
BorisLevitskiy
2015-04-09 18:36:17 +03:00
parent ca41485238
commit 2c184db805
3 changed files with 24 additions and 6 deletions

View File

@@ -39,12 +39,20 @@ module.exports = function(grunt) {
}
},
copy: {
files: {
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.

View File

@@ -35,6 +35,9 @@
<script type="text/javascript" src="js/app/cmd/commands.js"></script>
<!-- /build -->
<!-- build:js js/analytics.js -->
<!-- /build -->
<link rel="stylesheet" type="text/css" href="css/styles.css" />
</head>
<body id="rootView" class="dark">

7
src/js/analytics.js Normal file
View File

@@ -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');