Integrate Convert Experiences with Matomo

Introduction

Matomo (formerly Piwik) is a free and open source Web analytics application.

With the Convert-Matomo integration, unique visitors to your experiments’ variations will be passed into Matomo using custom variables.

Add Tracking Codes

To set up the integration, you should install the Matomo tracking code according to Matomo’s instructions. It looks like this:

You should also install the Convert tracking code (instructions can be found here).

Custom Variables

Create a Matomo Custom Variable and note its index. If you are already using Custom Variables for the same pages you intend to pass Convert data into, you should determine which indexes are in use so that you can choose a unique index number for Convert data.

Example of the data we send to Matomo:
dimension(or index) , current Experiment Name*, current Variation*, scope: "visit" (this means the custom variable applies to the current visit)

* Depends on whether you have chosen data anonymization or not (more information on this can be found here)

Enable the Integration in Convert

To enable the integration for your experiment, go to the Experience Summary, locate Settings, and under Integrations you should see a link to Add/Edit Integrations:

Experiment-Settings.png

Under here you will find the option to enable Matomo/Piwik integration and set the Dimension/Index you will use:

IntegrationScreen-ShowingDimensionAndArrow.png

Enable the Integration Manually

Instead of using the internal integration that Convert Experiences supports, you can also add this code and activate it manually:

var _paq = _paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  // you can set up to 5 custom variables for each visitor
        var refObject = window['convert']['data']['experiments']
			for (var key in window["convert"]["currentData"]["experiments"]) {
				if (!window["convert"]["currentData"]["experiments"].hasOwnProperty(key)) {
					continue;
				}}
            
		var currentExperiment = window["convert"]["currentData"]["experiments"][key];
		var curExperimentName = refObject[key] && refObject[key].n ? refObject[key].n : "unknown experiment name";
		curExperimentName = curExperimentName.replace("Test #", "Test ");
		var curVariant = currentExperiment['variation_name'] ? currentExperiment['variation_name'] : "unknown variant";
		curVariant = curVariant.replace("Var #", "Variation ");
  
  
  _paq.push(["setCustomVariable", 1, "Exp_Name", curExperimentName, "visit"]);
  _paq.push(["setCustomVariable", 2, "Value Name", curVariant, "visit"]);
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//con.innocraft.cloud/";
    _paq.push(['setTrackerUrl', u+'piwik.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+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();

View Convert Data in Matomo

Once you enable the integration (either through Convert interface or manually) you can view Experiment ID, Variation ID in Matomo dashboard:

Have more questions? Submit a request

Comments