Skip to content

Commit eb27b14

Browse files
authored
Add matomo tracker for javadoc (#15326)
1 parent 0838002 commit eb27b14

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

build-tools/build-infra/src/main/groovy/lucene.documentation.render-javadoc.gradle

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,34 @@ abstract class RenderJavadocTask extends RenderJavadocTaskBase {
389389
}
390390

391391
LuceneBuildGlobalsExtension buildGlobals = project.rootProject.extensions.getByType(LuceneBuildGlobalsExtension)
392-
opts << [
393-
'-bottom',
394-
"<i>Copyright &copy; 2000-${buildGlobals.buildYear} Apache Software Foundation. All Rights Reserved.</i>"
395-
]
392+
def copyright = "<i>Copyright &copy; 2000-${buildGlobals.buildYear} Apache Software Foundation. All Rights Reserved.</i>"
393+
if (luceneDocUrl.isPresent()) {
394+
opts << [
395+
'-bottom',
396+
"""<!-- Matomo -->
397+
<script>
398+
var _paq = window._paq = window._paq || [];
399+
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
400+
_paq.push(["setDoNotTrack", true]);
401+
_paq.push(["disableCookies"]);
402+
_paq.push(['trackPageView']);
403+
_paq.push(['enableLinkTracking']);
404+
(function() {
405+
var u="https://analytics.apache.org/";
406+
_paq.push(['setTrackerUrl', u+'matomo.php']);
407+
_paq.push(['setSiteId', '85']);
408+
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
409+
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
410+
})();
411+
</script>
412+
<!-- End Matomo Code -->${copyright}"""
413+
]
414+
} else {
415+
opts << [
416+
'-bottom',
417+
copyright
418+
]
419+
}
396420

397421
opts << [
398422
'-tag',

0 commit comments

Comments
 (0)