Forums | Mahara Community
Using Matomo / Piwik Codes
10 December 2019, 15:04
I'm testing a new installation of Mahara for some associates of mine and wanted to know if anyone is using Matomo / Piwik Analytics Code on any of their projects?
My question is where would one place the code so it collects user activity on most pages?
I presume that it would be somewhere in the Theme that is active, but of course I'm not sure, hence the reason for my question ... Any advisement would be greatly appreciated.
10 December 2019, 16:49
I add my piwik code to the footer.tpl file of the raw theme. Since all themes use the raw as the code base it will use the embedded code for most pages.
11 December 2019, 10:02
I'd recommend placing it into the config.php file with the help of the config value $cfg->additionalhtmlhead or $cfg->additionalhtmlfooter
You can see an example of what that would look like in /htdocs/lib/config-defaults.php.
By using that method, you don't need to touch a core file and don't have to watch out for a customisation during an upgrade.