Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-74067] Extract inline JavaScript from BuildMonitorView/index.jelly #1034

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address #1034 (comment)
  • Loading branch information
yaroslavafenkin committed Nov 13, 2024
commit f648f11eb046968b98c6cfa4948d8ec576bfd12f
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
Loading