This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch branch_9_8
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9_8 by this push:
     new f26976289cb SOLR-17633 Add matomo script to ref-guide (#3217)
f26976289cb is described below

commit f26976289cbd1150e778bd3999f1a80a69144e67
Author: Jan Høydahl <[email protected]>
AuthorDate: Wed Apr 30 19:09:55 2025 +0200

    SOLR-17633 Add matomo script to ref-guide (#3217)
    
    (cherry picked from commit 25309f64685a8b70a3bb79c4a07eb8e005724600)
---
 solr/solr-ref-guide/build.gradle                     |  4 ++--
 solr/solr-ref-guide/ui-src/partials/head-scripts.hbs | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/solr/solr-ref-guide/build.gradle b/solr/solr-ref-guide/build.gradle
index 3c6bec791e3..ee82a7691b0 100644
--- a/solr/solr-ref-guide/build.gradle
+++ b/solr/solr-ref-guide/build.gradle
@@ -416,7 +416,7 @@ task buildLocalAntoraSite(type: NpxTask) {
         "--fetch"
     ] + extraArgs
 
-    environment = ["SITE_SEARCH_ENABLED": "true"]
+    environment = ["SITE_SEARCH_ENABLED": "true", "MATOMO_ENABLED": "false"]
 
     inputs.files(fileTree(project.ext.siteStagingDir))
     inputs.property("Antora version", project.ext.antoraVersion)
@@ -511,7 +511,7 @@ task buildOfficialSite(type: NpxTask) {
         officialPlaybook,
     ] + extraArgs
 
-    environment = ["SITE_SEARCH_ENABLED": "true"]
+    environment = ["SITE_SEARCH_ENABLED": "true", "MATOMO_ENABLED": "true"]
 
     inputs.files(officialPlaybook)
     inputs.property("Antora version", project.ext.antoraVersion)
diff --git a/solr/solr-ref-guide/ui-src/partials/head-scripts.hbs 
b/solr/solr-ref-guide/ui-src/partials/head-scripts.hbs
new file mode 100644
index 00000000000..0604dbae2fb
--- /dev/null
+++ b/solr/solr-ref-guide/ui-src/partials/head-scripts.hbs
@@ -0,0 +1,19 @@
+<!-- Solr Changes - Start -->
+    {{#if env.MATOMO_ENABLED}}
+    <script>
+      var _paq = window._paq = window._paq || [];
+      /* tracker methods like "setCustomDimension" should be called before 
"trackPageView" */
+      _paq.push(["setDoNotTrack", true]);
+      _paq.push(["disableCookies"]);
+      _paq.push(['trackPageView']);
+      _paq.push(['enableLinkTracking']);
+      (function() {
+        var u="https://analytics.apache.org/";;
+        _paq.push(['setTrackerUrl', u+'matomo.php']);
+        _paq.push(['setSiteId', '76']);
+        var d=document, g=d.createElement('script'), 
s=d.getElementsByTagName('script')[0];
+        g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
+      })();
+    </script>
+    {{/if}}
+<!-- Solr Changes - End -->

Reply via email to