Hello all,
I use xwiki 14.1 and i try to make some statistics from my wiki.
But, i can’t find a guide to do this, the right way. I mean i configure matomo from https://matomo.org/docs/installation/ (all system checks ok).
But i realize that the Matomo Tracking Code is different from the XWiki’s extension of Matomo and i can’t change it on XWiki!!
Is there a way to make it works?
ps: I also check this from extension and it seems like the picture:
How to check Matomo requests?
- The Matomo requests done from XWiki can be checked when specific actions don’t seem to be recorded (maybe on a specific browser or a specific user)
- Example on Firefox:
Hello @Sarantis,
Can you show me the difference between the code expected by your matomo instance and the one produced by XWiki Matomo extension?
The last part of your post seems to be copied from the extension documentation. Didi you understand how to use it to test your configuration?
Thank you for your reply.
My code on Matomo:
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://example.com/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
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>
<!-- End Matomo Code -->
And on XWiki:
{{velocity}}
{{html clean="false"}}
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['setCustomVariable', 1, "user", "XWiki.User", "visit"]);
_paq.push(['setCustomVariable', 1, "user", "XWiki.User", "page"]);
_paq.push(['setUserId', "XWiki.User"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://example.com//";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
{{/html}}
{{/velocity}}
And with options:
Tracking method: Javascript tracking(there is no-other option)
Site ID: 1 (as the Matomo)
User tracking: YES
MultiDomain: NO
MultiWiki: NO
Yes is from the documentation, but i see the same screen except from the domain.
Where did you copy the code from? Is it from the html returned to the browser when visiting a page?
I don’t understand your question, to tell you the truth…
But i just paste here a copy, from my browser (firefox) the code, from my Matomo on-premise and from the matomo extension of my XWiki.
Not from the debug-inspect console, if that’s what you mean.
Looks like you have a problem with your installation, I tried to installed the extension and here it the result of the tracking produced by XWiki:
<div id="headerglobal">
<!-- ... -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['setCustomVariable', 1, "user", "xwiki:XWiki.Admin", "visit"]);
_paq.push(['setCustomVariable', 1, "user", "xwiki:XWiki.Admin", "page"]);
_paq.push(['setUserId', "xwiki:XWiki.Admin"]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="http://test/matomo/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 42]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
</div>
The velocity and html macro are supposed to be evaluation and not printed as is.
So i have to try to re-install the matomo extension? (I install it from the extension manager)
I’m not sure that would help. Did you notice anything that could be related in the logs?
On the debugger this is the first Warning, no Logs. (from xwiki matomo tab on firefox)
This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”. XWikiPreferences
And the others are:
Source map error: Error: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Resource URL: https://mywiki.com/xwiki/bin/jsx/TourCode/TourJS?language=en&docVersion=1.1
Source Map URL: http://mywiki.com/xwiki/bin/jsx/TourCode/TourJS?sourceMap=true&minify=false&language=en&docVersion=1.1
Source map error: Error: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Resource URL: https://mywiki.com/xwiki/bin/jsx/XWiki/QuickSearchUIX?language=en&docVersion=1.1
Source Map URL: http://mywiki.com/xwiki/bin/jsx/XWiki/QuickSearchUIX?sourceMap=true&minify=false&language=en&docVersion=1.1
Source map error: Error: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Resource URL: https://mywiki.com/xwiki/bin/jsx/XWiki/AdminSheet?language=en&docVersion=1.1
Source Map URL: http://mywiki.com/xwiki/bin/jsx/XWiki/AdminSheet?sourceMap=true&minify=false&language=en&docVersion=1.1
Source map error: Error: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Resource URL: https://mywiki.com/xwiki/bin/jsx/XWiki/Notifications/Code/BootstrapSwitch?minify=true
Source Map URL: http://mywiki.com/xwiki/bin/jsx/XWiki/Notifications/Code/BootstrapSwitch?sourceMap=true&minify=false&minify=true
Source map error: Error: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Resource URL: https://mywiki.com/xwiki/bin/jsx/XWiki/Notifications/Code/NotificationsDisplayerUIX?language=en&docVersion=2.1
Source Map URL: http://mywiki.com/xwiki/bin/jsx/XWiki/Notifications/Code/NotificationsDisplayerUIX?sourceMap=true&minify=false&language=en&docVersion=2.1
Source map error: Error: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Resource URL: https://mywiki.com/xwiki/bin/jsx/AnnotationCode/Settings?language=en&docVersion=2.1
Source Map URL: http://mywiki.com/xwiki/bin/jsx/AnnotationCode/Settings?sourceMap=true&minify=false&language=en&docVersion=2.1
Source map error: Error: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Resource URL: https://mywiki.com/xwiki/bin/jsx/AnnotationCode/Script?language=en&docVersion=2.1
Source Map URL: http://mywiki.com/xwiki/bin/jsx/AnnotationCode/Script?sourceMap=true&minify=false&language=en&docVersion=2.1
Source map error: Error: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Resource URL: https://mywiki.com/xwiki/bin/jsx/XWiki/Mentions/MentionsMacro?language=en&docVersion=2.1
Source Map URL: http://mywiki.com/xwiki/bin/jsx/XWiki/Mentions/MentionsMacro?sourceMap=true&minify=false&language=en&docVersion=2.1
I have also the default statistics function from XWiki running. Is there a chance for a conflict?
Or, is there a chance that javascript on wiki is not enabled? how i can check this?