diff --git a/build-monitor-plugin/src/main/resources/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView/collect-usage-stats.js b/build-monitor-plugin/src/main/resources/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView/collect-usage-stats.js index 764510b5..f44981e2 100644 --- a/build-monitor-plugin/src/main/resources/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView/collect-usage-stats.js +++ b/build-monitor-plugin/src/main/resources/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView/collect-usage-stats.js @@ -1,31 +1,33 @@ -window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; +window.addEventListener("DOMContentLoaded", () => { + window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; -const { - buildMonitorVersion, - jenkinsVersion, - installationSize, - itemsSize, - installationAudience, - anonymousCorrelationId -} = document.querySelector('.build-monitor-ga-data-holder').dataset; + const { + buildMonitorVersion, + jenkinsVersion, + installationSize, + itemsSize, + installationAudience, + anonymousCorrelationId + } = document.querySelector('.build-monitor-ga-data-holder').dataset; -ga('create', 'UA-61694827-4', 'auto', { - 'userId': anonymousCorrelationId, - 'sampleRate': 1 -}); + ga('create', 'UA-61694827-4', 'auto', { + 'userId': anonymousCorrelationId, + 'sampleRate': 1 + }); -ga('set', { - 'forceSSL': true, - 'appName': 'Build Monitor', - 'appId': 'build-monitor-plugin', + ga('set', { + 'forceSSL': true, + 'appName': 'Build Monitor', + 'appId': 'build-monitor-plugin', - 'appVersion': buildMonitorVersion, - 'appInstallerId': jenkinsVersion, + 'appVersion': buildMonitorVersion, + 'appInstallerId': jenkinsVersion, - 'dimension1': installationSize, - 'dimension2': itemsSize, - 'dimension3': installationAudience, - 'dimension4': anonymousCorrelationId -}); + 'dimension1': installationSize, + 'dimension2': itemsSize, + 'dimension3': installationAudience, + 'dimension4': anonymousCorrelationId + }); -ga('send', 'screenview', {screenName: 'Dashboard'}); + ga('send', 'screenview', {screenName: 'Dashboard'}); +}); diff --git a/build-monitor-plugin/src/main/resources/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView/index.jelly b/build-monitor-plugin/src/main/resources/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView/index.jelly index a5a30cab..3a4895cb 100644 --- a/build-monitor-plugin/src/main/resources/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView/index.jelly +++ b/build-monitor-plugin/src/main/resources/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView/index.jelly @@ -55,13 +55,6 @@ - @@ -76,6 +69,15 @@ Jenkins

${it.title}

+ + +