diff --git a/src/index.html b/src/index.html
index 141589bcf..ed2b2a9fb 100644
--- a/src/index.html
+++ b/src/index.html
@@ -60,6 +60,7 @@
waitSeconds: 30
};
+ // Progress Bar
(function () {
var progressBar = document.getElementById('app_loading_progress');
var message = document.getElementById('app_loading_message');
@@ -78,6 +79,7 @@
window.__setAppLoadingProgress(5, 'Downloading Assets');
window.__PAGE_LOAD_TIMESTAMP = new Date();
+ // Show a reload button if the page is taking too long
setTimeout(function check () {
if (progressValue !== 100) {
var msg = 'Loading the application is taking a long time... ';
diff --git a/src/js/apps/discovery/main.js b/src/js/apps/discovery/main.js
index 6c74739b1..f1af08398 100644
--- a/src/js/apps/discovery/main.js
+++ b/src/js/apps/discovery/main.js
@@ -20,13 +20,9 @@ define(['config', 'module'], function(config, module) {
'js/components/application',
'js/mixins/discovery_bootstrap',
'js/mixins/api_access',
+ 'analytics',
'es5-shim'
- ],
- function(Router,
- Application,
- DiscoveryBootstrap,
- ApiAccess
- ) {
+ ], function(Router, Application, DiscoveryBootstrap, ApiAccess, analytics) {
var updateProgress = (typeof window.__setAppLoadingProgress === 'function') ?
window.__setAppLoadingProgress : function () {};
@@ -54,7 +50,6 @@ define(['config', 'module'], function(config, module) {
var pubsub = app.getService('PubSub');
pubsub.publish(pubsub.getCurrentPubSubKey(), pubsub.APP_LOADED);
-
// set some important urls, parameters before doing anything
app.configure();
@@ -90,6 +85,21 @@ define(['config', 'module'], function(config, module) {
window.bbb = app;
}
+ // app is loaded, send timing event
+
+ if (__PAGE_LOAD_TIMESTAMP) {
+ var time = new Date() - __PAGE_LOAD_TIMESTAMP;
+ analytics('send', {
+ hitType: 'timing',
+ timingCategory: 'Application',
+ timingVar: 'Loaded',
+ timingValue: time
+ });
+ if (debug) {
+ console.log('Application Started: ' + time + 'ms');
+ }
+
+ }
}).fail(function () {
app.redirect('500.html');
});
@@ -104,8 +114,4 @@ define(['config', 'module'], function(config, module) {
});
});
-
-
-
-
});