move scripts in body. analytics fix

This commit is contained in:
Kyle Spearrin 2017-10-05 15:59:45 -04:00
parent d8536e3090
commit 671b43d6b1
2 changed files with 29 additions and 13 deletions

View File

@ -8,8 +8,6 @@
<!-- @if true !>
<link rel="stylesheet" href="popup.css">
<script src="lib.js"></script>
<script src="app.js"></script>
<!-- @endif -->
<!-- @exclude -->
<link rel="stylesheet" href="css/webfonts.css">
@ -17,14 +15,21 @@
<link rel="stylesheet" href="../lib/angular-toastr/angular-toastr.css">
<link rel="stylesheet" href="../lib/sweetalert/sweetalert.css">
<link rel="stylesheet" href="css/popup.css">
<!-- @endexclude -->
</head>
<body ng-controller="mainController as main" class="{{main.animation}}"
ng-class="{lg: main.lgBody, sm: main.smBody, xs: main.xsBody }">
<div ui-view class="main-view"></div>
<!-- @if true !>
<script src="lib.js"></script>
<script src="app.js"></script>
<!-- @endif -->
<!-- @exclude -->
<script src="../lib/jquery/jquery.js"></script>
<script src="../lib/bootstrap/js/bootstrap.js"></script>
<script src="../lib/papaparse/papaparse.js"></script>
<script src="../lib/clipboard/clipboard.js"></script>
<script src="../scripts/analytics.js"></script>
<script src="../scripts/duo.js"></script>
<script src="../scripts/u2f.js"></script>
<script src="../lib/angular/angular.js"></script>
<script src="../lib/angular-animate/angular-animate.js"></script>
@ -37,14 +42,18 @@
<script src="../lib/angulartics/angulartics-ga.js"></script>
<script src="../lib/ng-infinite-scroll/ng-infinite-scroll.js"></script>
<script src="app/app.js"></script>
<script src="app/config.js"></script>
<script src="../scripts/analytics.js"></script>
<script src="../scripts/duo.js"></script>
<script src="../scripts/u2f.js"></script>
<script src="../models/api/requestModels.js"></script>
<script src="../models/api/responseModels.js"></script>
<script src="../models/dataModels.js"></script>
<script src="../models/domainModels.js"></script>
<script src="app/app.js"></script>
<script src="app/config.js"></script>
<script src="app/directives/directivesModule.js"></script>
<script src="app/directives/formDirective.js"></script>
<script src="app/directives/stopClickDirective.js"></script>
@ -101,9 +110,5 @@
<script src="app/lock/lockModule.js"></script>
<script src="app/lock/lockController.js"></script>
<!-- @endexclude -->
</head>
<body ng-controller="mainController as main" class="{{main.animation}}"
ng-class="{lg: main.lgBody, sm: main.smBody, xs: main.xsBody }">
<div ui-view class="main-view"></div>
</body>
</html>

View File

@ -29,11 +29,19 @@
'&ea=' + encodeURIComponent(options.eventAction) +
(options.eventLabel ? '&el=' + encodeURIComponent(options.eventLabel) : '') +
(options.eventValue ? '&ev=' + encodeURIComponent(options.eventValue) : '') +
(options.page ? '&dp=' + encodeURIComponent(options.page) : '');
(options.page ? '&dp=' + cleanPagePath(options.page) : '');
}
function gaTrackPageView(pagePath) {
return '&t=pageview&dp=' + encodeURIComponent(pagePath);
return '&t=pageview&dp=' + cleanPagePath(pagePath);
}
function cleanPagePath(pagePath) {
var paramIndex = pagePath.indexOf('?');
if (paramIndex > -1) {
pagePath = pagePath.substring(0, paramIndex);
}
return encodeURIComponent(pagePath)
}
bgPage.bg_appIdService.getAnonymousAppId(function (gaAnonAppId) {
@ -48,6 +56,9 @@
if (param1 === 'pageview' && param2) {
message += gaTrackPageView(param2);
}
else if (typeof param1 === 'object' && param1.hitType === 'pageview') {
message += gaTrackPageView(param1.page);
}
else if (param1 === 'event' && param2) {
message += gaTrackEvent(param2);
}