diff --git a/.gitignore b/.gitignore index 37db380..5b5095f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,6 @@ bower_components .vagrant results/* coverage +front/build har.json \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 8a4fa1d..f2c3ae6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,14 +1,12 @@ module.exports = function(grunt) { - var DEV_SERVER_PORT = 8383; - var TEST_SERVER_PORT = 8387; - // Tell our Express server that Grunt launched it process.env.GRUNTED = true; // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), + settings: grunt.file.readJSON('./server_config/settings.json'), font: { icons: { @@ -37,6 +35,21 @@ module.exports = function(grunt) { ] } }, + replace: { + dist: { + options: { + patterns: [ + { + match: 'googleAnalyticsId', + replacement: '<%= settings.googleAnalyticsId %>' + } + ] + }, + files: [ + {expand: true, flatten: true, src: ['front/src/main.html'], dest: 'front/build/'} + ] + } + }, jshint: { all: [ '*.js', @@ -171,7 +184,8 @@ module.exports = function(grunt) { ]); grunt.registerTask('build', [ - 'less' + 'less', + 'replace' ]); grunt.registerTask('hint', [ diff --git a/front/src/js/app.js b/front/src/js/app.js index 612ad18..445c20c 100644 --- a/front/src/js/app.js +++ b/front/src/js/app.js @@ -12,9 +12,14 @@ var yltApp = angular.module('YellowLabTools', [ 'gradeDirective', ]); -yltApp.run(function($rootScope) { +yltApp.run(['$rootScope', '$location', function($rootScope, $location) { $rootScope.loadedRunId = null; -}); + + // Google Analytics + $rootScope.$on('$routeChangeSuccess', function(){ + ga('send', 'pageview', {'page': $location.path()}); + }); +}]); yltApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { diff --git a/front/src/main.html b/front/src/main.html index 6015d59..8522dcd 100644 --- a/front/src/main.html +++ b/front/src/main.html @@ -35,5 +35,15 @@
+ +