Top
Integrating Matomo aka Piwik on-premise analytics
  • 1 minute to read
  • Print
  • Dark
    Light

Integrating Matomo aka Piwik on-premise analytics

  • Print
  • Dark
    Light

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

Configure Matomo on-Premise using the following instructions

  1. Install Matomo on-Premise using instructions from Install and Setup Matomo
  2. Now you can create or add scripts in in advanced customization to capture various kinds of analytic data. For more infomation see Custom Analytics API
  3. 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 acccount.

  1. 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]);
     }

}

your title goes here

To track the analytics for other criteria actions using scripts, contact your CSM.

Was this article helpful?