Integrating Matomo aka Piwik on-premise analytics
- 07 Sep 2022
- 1 Minute To Read
-
Print
-
DarkLight
-
PDF
Integrating Matomo aka Piwik on-premise analytics
- Updated On 07 Sep 2022
- 1 Minute To Read
-
Print
-
DarkLight
-
PDF
You can integrate Matomo analytics to analyze how your content is performing using Whatfix APIs. Some information that you can track includes,
- how many users are completing a Flow
- how many are closing the Flow before completing it and if so at which step
- what users are searching for content in Self help
Use the following steps to configure Matomo on-Premise,
- Install Matomo on-Premise using instructions from Install and Setup Matomo
- Now you can create or add scripts in Advanced Customization to capture various kinds of analytic data. For more information, contact Whatfix Support at [email protected].
- Use the following code to initialize Matomo with Whatfix
var _paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//xx.xxx.xx.xx/matomo/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
your title goes here
In the script above replace xx.xxx.xx.xx with the respective IP address that you use for your Matomo account.
- You can now add scripts to capture specific information. For example, to capture the number of times a flow is triggered use the following script.
window._wfx_settings.tracker = {
track:track,
};
function track(event){
//Push data to matomo
_paq.push(['setCustomUrl',event.on_id]);
_paq.push(['trackPageView']);
if(event.flow_id!=null)
{
//Push data to matomo
_paq.push(['setCustomVariable','1','flow_id',event.flow_id]);
_paq.push([ function() { var customVariable = this.getCustomVariable(1); }]);
}
if(event.event_name != null && event.event_name == "trackSelfHelpClicked")
{
//Push data to matomo
_paq.push(['trackEvent', 'SelfHelp Clicked', event.event_name]);
}
}
Note
To track the analytics for other criteria actions using scripts, contact [email protected].
Was this article helpful?