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

rohit pushed a commit to branch staging-site
in repository https://gitbox.apache.org/repos/asf/cloudstack-www.git


The following commit(s) were added to refs/heads/staging-site by this push:
     new 46ebacca1 fix build issue
46ebacca1 is described below

commit 46ebacca170859216c8f9c77e714ff943269c602
Author: Rohit Yadav <[email protected]>
AuthorDate: Thu Oct 17 13:45:33 2024 +0530

    fix build issue
    
    refer: https://docusaurus.io/docs/2.x/advanced/ssg#executionenvironment
    
    Signed-off-by: Rohit Yadav <[email protected]>
---
 asf-matomo.js | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/asf-matomo.js b/asf-matomo.js
index 22eb22479..8848bf9ca 100644
--- a/asf-matomo.js
+++ b/asf-matomo.js
@@ -1,12 +1,16 @@
-var _paq = window._paq = window._paq || [];
-_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', '49']);
-  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);
-})();
+import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
+
+if (ExecutionEnvironment.canUseDOM) {
+  var _paq = window._paq = window._paq || [];
+  _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', '49']);
+    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);
+  })();
+}

Reply via email to