You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2022/08/31 00:35:09 UTC

[nifi-site] branch main-staging updated: NIFI-10416 Enabled Matomo Website Analytics

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

exceptionfactory pushed a commit to branch main-staging
in repository https://gitbox.apache.org/repos/asf/nifi-site.git


The following commit(s) were added to refs/heads/main-staging by this push:
     new c7c9f05  NIFI-10416 Enabled Matomo Website Analytics
c7c9f05 is described below

commit c7c9f058d3d4c4fea1ffa8f036165d8b13ce7c2c
Author: exceptionfactory <ex...@apache.org>
AuthorDate: Tue Aug 30 19:34:58 2022 -0500

    NIFI-10416 Enabled Matomo Website Analytics
---
 config.toml                  |  3 +++
 layouts/_default/baseof.html |  1 +
 layouts/partials/matomo.html | 19 +++++++++++++++++++
 3 files changed, 23 insertions(+)

diff --git a/config.toml b/config.toml
index fb14f92..0601ca0 100644
--- a/config.toml
+++ b/config.toml
@@ -39,6 +39,9 @@ siteRepositoryUrl = "https://github.com/apache/nifi-site"
 siteRepositorySourceBranch = "main"
 assets = "assets"
 
+matomoSiteId = 28
+productionHost = "nifi.apache.org"
+
 dynamicDownloadPathUrl = "https://www.apache.org/dyn/closer.lua?path=/nifi"
 downloadPathUrl = "https://downloads.apache.org/nifi"
 archiveDownloadPathUrl = "https://archive.apache.org/dist/nifi"
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 298591d..2a37bd8 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -10,6 +10,7 @@
         <link rel="stylesheet" href="/assets/stylesheets/font-awesome.min.css">
         <script src="/assets/js/modernizr.js"></script>
         <script src="/assets/js/webfontloader.js"></script>
+        {{ partial "matomo.html" . -}}
     </head>
     <body>
         {{- if .Params.menu -}}
diff --git a/layouts/partials/matomo.html b/layouts/partials/matomo.html
new file mode 100644
index 0000000..fca0004
--- /dev/null
+++ b/layouts/partials/matomo.html
@@ -0,0 +1,19 @@
+<script>
+  var _paq = window._paq = window._paq || [];
+  _paq.push(['disableCookies']);
+  _paq.push(['trackPageView']);
+  _paq.push(['enableLinkTracking']);
+  (function() {
+    var baseUri = "//matomo.privacy.apache.org/";
+    _paq.push(['setTrackerUrl', baseUri + 'matomo.php']);
+    _paq.push(['setSiteId', '{{ .Site.Params.matomoSiteId }}']);
+    var trackerElement = document.createElement('script');
+    var firstScriptElement = document.getElementsByTagName('script')[0];
+    trackerElement.async = true;
+    trackerElement.src = baseUri + 'matomo.js';
+    var firstScriptElement = document.getElementsByTagName('script')[0];
+    if (window.location.host === '{{ .Site.Params.productionHost }}') {
+      firstScriptElement.parentNode.insertBefore(trackerElement, firstScriptElement);
+    }
+  })();
+</script>