Skip to content

Commit

Permalink
Address #1034 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslavafenkin committed Nov 13, 2024
1 parent b87776d commit f648f11
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -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'});
});
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@
<script src="${resourcesURL}/vendor/angular-slider-5.4.0/rzslider.min.js"></script>

<j:if test="${it.collectAnonymousUsageStatistics()}">
<span class="build-monitor-ga-data-holder"
data-build-monitor-version="${it.installation.buildMonitorVersion()}"
data-jenkins-version="${h.version}"
data-installation-size="${it.installation.size()}"
data-items-size="${it.items.size()}"
data-installation-audience="${it.installation.audience()}"
data-anonymous-correlation-id="${it.installation.anonymousCorrelationId()}"/>
<st:adjunct includes="com.smartcodeltd.jenkinsci.plugins.buildmonitor.BuildMonitorView.collect-usage-stats"/>
<script async="async" src='//www.google-analytics.com/analytics.js'></script>
</j:if>
Expand All @@ -76,6 +69,15 @@
<a class="home-link" href="${rootURL}/" title="Jenkins">Jenkins</a>
<h1><a href="configure" title="Configure the '${it.title}' view">${it.title}</a></h1>
<st:include page="main-settings.jelly"/>
<j:if test="${it.collectAnonymousUsageStatistics()}">
<span class="build-monitor-ga-data-holder"
data-build-monitor-version="${it.installation.buildMonitorVersion()}"
data-jenkins-version="${h.version}"
data-installation-size="${it.installation.size()}"
data-items-size="${it.items.size()}"
data-installation-audience="${it.installation.audience()}"
data-anonymous-correlation-id="${it.installation.anonymousCorrelationId()}"/>
</j:if>
</header>

<j:choose>
Expand Down

0 comments on commit f648f11

Please sign in to comment.