mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Adding google anayltics tracking
This commit is contained in:
@@ -38,5 +38,16 @@
|
|||||||
|
|
||||||
<script src="lib.js" type="text/javascript"></script>
|
<script src="lib.js" type="text/javascript"></script>
|
||||||
<script src="app.js" type="text/javascript"></script>
|
<script src="app.js" type="text/javascript"></script>
|
||||||
|
<% if (uaTracking) { %>
|
||||||
|
<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');
|
||||||
|
|
||||||
|
ga('create', '<%= uaTracking %> ', 'auto');
|
||||||
|
</script>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,11 +1,16 @@
|
|||||||
angular.module('app', ['ui.router', 'shipyard', 'ngLodash', 'app.templates'])
|
angular.module('app', ['ui.router', 'shipyard', 'ngLodash', 'app.templates'])
|
||||||
.run(['$rootScope','$document','$state','commonArray','shipPurpose','shipSize','hardPointClass','internalGroupMap','hardpointsGroupMap', function ($rootScope, $doc, $state, CArr, shipPurpose, sz, hpc, igMap, hgMap) {
|
.run(['$rootScope', '$location', '$window', '$document','$state','commonArray','shipPurpose','shipSize','hardPointClass','internalGroupMap','hardpointsGroupMap', function ($rootScope, $location, $window, $doc, $state, CArr, shipPurpose, sz, hpc, igMap, hgMap) {
|
||||||
// Redirect any state transition errors to the error controller/state
|
// Redirect any state transition errors to the error controller/state
|
||||||
$rootScope.$on('$stateChangeError', function(e, toState, toParams, fromState, fromParams, error){
|
$rootScope.$on('$stateChangeError', function(e, toState, toParams, fromState, fromParams, error){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$state.go('error', error, {location:false, reload:true}); // Go to error state, reload the controller, keep the current URL
|
$state.go('error', error, {location:false, reload:true}); // Go to error state, reload the controller, keep the current URL
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Track on Google analytics if available
|
||||||
|
$rootScope.$on('$stateChangeSuccess', function() {
|
||||||
|
if ($window.ga) ga('send', 'pageview', {page: $location.path()});
|
||||||
|
});
|
||||||
|
|
||||||
// Global Reference variables
|
// Global Reference variables
|
||||||
$rootScope.CArr = CArr;
|
$rootScope.CArr = CArr;
|
||||||
$rootScope.SP = shipPurpose;
|
$rootScope.SP = shipPurpose;
|
||||||
|
|||||||
@@ -108,7 +108,8 @@ gulp.task('generateIndexHTML', function() {
|
|||||||
return gulp.src('app/index.html')
|
return gulp.src('app/index.html')
|
||||||
.pipe(template({
|
.pipe(template({
|
||||||
version: pkg.version,
|
version: pkg.version,
|
||||||
date : (new Date()).toLocaleDateString()
|
date : (new Date()).toLocaleDateString(),
|
||||||
|
uaTracking: process.env.CORIOLIS_UA_TRACKING
|
||||||
}))
|
}))
|
||||||
.pipe(htmlmin({
|
.pipe(htmlmin({
|
||||||
'collapseBooleanAttributes': true,
|
'collapseBooleanAttributes': true,
|
||||||
|
|||||||
Reference in New Issue
Block a user