Matomo follow-up Version 2.9 and higher Version 2.7 and 2.8 Version 2.6 and lower Advanced settings: statistics on searched keywords Displaying Matomo statistics Matomo follow-up Version 2.9 and higher 1. Import the following XSL :
Oops! Copy to clipboard failed. Open the code and copy it manually.<xsl:import href="gdpr:matomo"/> <xsl:import href="gdpr:matomo"/>
<xsl:import href="gdpr:matomo"/> 2. Dans la section "<head>" de vos chartes, faire appel au template "matomo"
Oops! Copy to clipboard failed. Open the code and copy it manually.<html>
<head>
[...]
<xsl:call-template name="matomo"/>
</head>
<body>
[...]
</body>
</html> <html>
<head>
[...]
<xsl:call-template name="matomo"/>
</head>
<body>
[...]
</body>
</html>
<html>
<head>
[...]
<xsl:call-template name="matomo"/>
</head>
<body>
[...]
</body>
</html> Version 2.7 and 2.8 1. Import the following XSL :
Oops! Copy to clipboard failed. Open the code and copy it manually.<xsl:import href="gdpr:piwik"/> <xsl:import href="gdpr:piwik"/>
<xsl:import href="gdpr:piwik"/> 2. Dans la section "<head>" de vos chartes, faire appel au template "piwik"
Oops! Copy to clipboard failed. Open the code and copy it manually.<html>
<head>
[...]
<xsl:call-template name="piwik"/>
</head>
<body>
[...]
</body>
</html> <html>
<head>
[...]
<xsl:call-template name="piwik"/>
</head>
<body>
[...]
</body>
</html>
<html>
<head>
[...]
<xsl:call-template name="piwik"/>
</head>
<body>
[...]
</body>
</html> Version 2.6 and lower 1. Import the following XSL :
Oops! Copy to clipboard failed. Open the code and copy it manually.<xsl:import href="plugin:web-analytics://stylesheets/piwik.xsl"/> <xsl:import href="plugin:web-analytics://stylesheets/piwik.xsl"/>
<xsl:import href="plugin:web-analytics://stylesheets/piwik.xsl"/> 2. Dans la section "<head>" de vos chartes, faire appel au template "piwik"
Oops! Copy to clipboard failed. Open the code and copy it manually.<html>
<head>
[...]
<xsl:call-template name="piwik"/>
</head>
<body>
[...]
</body>
</html> <html>
<head>
[...]
<xsl:call-template name="piwik"/>
</head>
<body>
[...]
</body>
</html>
<html>
<head>
[...]
<xsl:call-template name="piwik"/>
</head>
<body>
[...]
</body>
</html> Advanced settings: statistics on searched keywords Keyword statistics is not compatible with the use of the cookie manager tarteaucitron
Matomo provides statistics on the most searched keywords.
By default Ametys sends the Matomo server the keywords searched for via the "texfield" search field.
If you need to track one or more other search fields, use the "matomo" template (or "piwik" depending on the version of your plugin web-analytics), specifying the name(s) of the search fields to be tracked as in the example below:
Oops! Copy to clipboard failed. Open the code and copy it manually.<xsl:call-template name="matomo">
<xsl:with-param name="keywordFields">
<fields>
<field name="textfield"/>
<field name="fulltext"/>
<field name="keywords"/>
</fields>
</xsl:with-param>
</xsl:call-template> <xsl:call-template name="matomo">
<xsl:with-param name="keywordFields">
<fields>
<field name="textfield"/>
<field name="fulltext"/>
<field name="keywords"/>
</fields>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="matomo">
<xsl:with-param name="keywordFields">
<fields>
<field name="textfield"/>
<field name="fulltext"/>
<field name="keywords"/>
</fields>
</xsl:with-param>
</xsl:call-template> Displaying Matomo statistics From version 2.9.0
From version 2.9.0 onwards, Matomo statistics on the number of views can be retrieved and displayed.
Pour cela vous devrez importer le JS suivant dans la section <head> de votre charte graphique:
Oops! Copy to clipboard failed. Open the code and copy it manually.<script src="{ametys:pluginResourceURL('web-analytics', 'js/AmetysMatomoHelper.js')}" type="text/javascript"/> <script src="{ametys:pluginResourceURL('web-analytics', 'js/AmetysMatomoHelper.js')}" type="text/javascript"/>
<script src="{ametys:pluginResourceURL('web-analytics', 'js/AmetysMatomoHelper.js')}" type="text/javascript"/> This file provides a JS helper AmetysMatomoHelper.getPageData to retrieve statistics on the number of views of the current page. The arguments are as follows:
selector : jquery selector to identify the HTML element that will display the statisticscontextPath : the path to the current contextpageUrl : url absolute value of the page for which you wish to obtain statistics. Leave empty or null for current pagecallback : JS function to be called after statistics retrieval (optional)The helper retrieves the statistics from the Matomo server and modifies the target HTML elements identified by a "data-matomo" attribute as follows:
data-matomo="nb-visits": total number of viewsdata-matomo="nb-visits-last-days": number of views over the last X days, where X is defined in the site parametersdata-matomo="last-days": range of the last X daysExample of integration:
Oops! Copy to clipboard failed. Open the code and copy it manually.<div class="stats" style="display: none">
<span data-matomo="nb-visits" ></span> vues dont <span data-matomo="nb-visits-last-days"></span> les <span data-matomo="last-days"></span> derniers jours
</div>
<script type="text/javascript">
$j(document).ready(function() {
AmetysMatomoHelper.getPageData(".stats", "<xsl:value-of select="$site-uri-prefix" />", null, function() {
$j(".stats").show();
});
});
</script> <div class="stats" style="display: none">
<span data-matomo="nb-visits" ></span> vues dont <span data-matomo="nb-visits-last-days"></span> les <span data-matomo="last-days"></span> derniers jours
</div>
<script type="text/javascript">
$j(document).ready(function() {
AmetysMatomoHelper.getPageData(".stats", "<xsl:value-of select="$site-uri-prefix" />", null, function() {
$j(".stats").show();
});
});
</script>
<div class="stats" style="display: none">
<span data-matomo="nb-visits" ></span> vues dont <span data-matomo="nb-visits-last-days"></span> les <span data-matomo="last-days"></span> derniers jours
</div>
<script type="text/javascript">
$j(document).ready(function() {
AmetysMatomoHelper.getPageData(".stats", "<xsl:value-of select="$site-uri-prefix" />", null, function() {
$j(".stats").show();
});
});
</script>