Add Google Analytics

This commit is contained in:
Gaël Métais
2014-12-30 08:11:47 +01:00
parent 9bf420d317
commit 17a644c5d8
6 changed files with 41 additions and 12 deletions
+1
View File
@@ -3,5 +3,6 @@ bower_components
.vagrant
results/*
coverage
front/build
har.json
+18 -4
View File
@@ -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', [
+7 -2
View File
@@ -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) {
+10
View File
@@ -35,5 +35,15 @@
<div class="footer">
<p><a href="/about">Learn more</a><br>If you like <b>Yellow Lab Tools</b>, <a href="https://github.com/gmetais/YellowLabTools" target="_blank" class="star">give it a <span>&#9733;</span> on GitHub</a>!</p>
</div>
<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');
if ('@@googleAnalyticsId'.indexOf('UA-') === 0) {
ga('create', '@@googleAnalyticsId', 'auto');
}
</script>
</body>
</html>
+1
View File
@@ -32,6 +32,7 @@
"grunt-express": "^1.4.1",
"grunt-fontsmith": "^0.9.1",
"grunt-mocha-test": "^0.12.4",
"grunt-replace": "^0.8.0",
"matchdep": "^0.3.0",
"mocha": "^2.1.0",
"phantomjs": "^1.9.13",
+4 -6
View File
@@ -1,12 +1,10 @@
{
"serverPort": 80,
"googleAnalyticsId": "UA-54493828-1",
"googleAnalyticsId": "",
"authorized-keys": {
"authorizedKeys": {
},
"tokenSalt": "",
"authorizedApplications": [
]
"maxAnonymousRunsPerDay": 50,
"maxAnonymousCallsPerDay": 2000
}