Matomo Web analytics
Like Tiki, Matomo is written in PHP and uses a MySQL database.
Integrating Matomo with Tiki
To record visitors, visits and page views in Matomo, you must add a Tracking code in all your pages. Matomo recommend to use the standard JavaScript Tracking tag.
The documentation is here:
http://matomo.org/docs/javascript-tracking/
Copy the code from Matomo and paste in Admin -> Look & Feel -> General Layout or Customization (depends on your version of Tiki) -> Custom End of <body> Code surrounded by literal tags, as shown below:
{literal} <!-- Matomo--> <script type="text/javascript"> ... ... ... </script> <!-- End Matomo Tag --> {/literal}
The literal tags indicate to the Smarty template engine not to interpret the code and to pass it as-is.
direct URL to access Custom End of <body> Code is: tiki-admin.php?page=look&cookietab=2
{if $tiki_p_admin neq 'y'} {literal} <!-- Matomo --> <script type="text/javascript"> ... ... ... </script> <!-- End Matomo Tag --> {/literal} {/if}
Going Further
To identify users logged into Tiki and track their activity, modify the default Matomo code to pass the Tiki username to Matomo . This is done by adding the following in Admin -> Look & Feel -> Custom End of <body> Code. Note that the Tiki username must be passed before 'trackPageView' in the default Matomo code to track user activity reliably.
{literal} <!-- Matomo --> <script type="text/javascript"> ... ... ... {/literal} {if $user}{literal} _paq.push(['setUserId', {/literal}'{$user}'{literal}]);{/literal} {/if}{literal} _paq.push(['trackPageView']); ... ... ... </script> <!-- End Matomo Tag --> {/literal}
Matomo Visitor Log with Tiki user information
Embedding Matomo report on a wiki page
It is possible to embed Matomo report into wiki page.
- In Matomo Admin
- Permission and User
- Go to setting, users.
- Set permission for anonymous so all the data will be public or create a specific user to create a token that will be used for authentication (recommended and explained here).
- In Manage Access give this user "View" permission for the website(s) you want the token to be used to share the report.
- Report Selection and Credentials
- Click on the user icon (top right), select widget
- Select the kind of report you want to display and copy the HTML code found in the field "Embed Iframe" (at the bottom of the preview). Paste it in a text-editor.
- Add at the end of the "src" (it should start by "http://example.org...") the parameter to the API calls URLs that require authentication: "&token_auth=". Paste the token_auth you created for your specific user.
You have now all the necessary and basic code that should be placed in a Tiki Wiki page.
- In Tiki
- Create or edit the page where you want to display the report.
- Set permission for your usage (it can be embedded inside group plugin for example).
- Insert an HTML plugin and paste the code you've prepared.
- Approve the plugin
- Tada !
Visits Summary, Visits Overview (with graph) for doc.tiki.org (previous day)
Visitor Setting, Screen Resolution for doc.tiki.org (previous day)
Actions, Pages for doc.tiki.org (previous day)
See also Template Tricks
Related: Google Analytics