Add Google Analytics
This commit is contained in:
@@ -3,5 +3,6 @@ bower_components
|
||||
.vagrant
|
||||
results/*
|
||||
coverage
|
||||
front/build
|
||||
|
||||
har.json
|
||||
+18
-4
@@ -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
@@ -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) {
|
||||
|
||||
@@ -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>★</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>
|
||||
@@ -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",
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
{
|
||||
"serverPort": 80,
|
||||
"googleAnalyticsId": "UA-54493828-1",
|
||||
"googleAnalyticsId": "",
|
||||
|
||||
"authorized-keys": {
|
||||
"authorizedKeys": {
|
||||
|
||||
},
|
||||
"tokenSalt": "",
|
||||
"authorizedApplications": [
|
||||
|
||||
]
|
||||
"maxAnonymousRunsPerDay": 50,
|
||||
"maxAnonymousCallsPerDay": 2000
|
||||
}
|
||||
Reference in New Issue
Block a user