Top
Integrating Matomo aka Piwik on-premise analytics
  • 07 Sep 2022
  • 1 Minute To Read
  • Dark
    Light
  • PDF

Integrating Matomo aka Piwik on-premise analytics

  • Dark
    Light
  • 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,

  1. Install Matomo on-Premise using instructions from Install and Setup Matomo
  2. 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].
  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 account.

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

}

Note

To track the analytics for other criteria actions using scripts, contact [email protected].


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.