Matomo, formerly Piwik, is an open source web analytics platform. It can be used to derive valuable insights into your website's visitors and marketing campaigns so as to optimize your strategy and online experience for your visitors.

RudderStack supports Matomo as a destination to which you can seamlessly send your event data.

Getting started

Before configuring Matomo as a destination in RudderStack, verify if the source platform is supported by Matomo by referring to the table below:

Connection ModeWebMobileServer
Device modeSupported--
Cloud mode---
To know more about the difference between cloud mode and device mode in RudderStack, refer to the RudderStack Connection Modes guide.

Once you have confirmed that the source platform supports sending events to Matomo, follow these steps:

  1. From your RudderStack dashboard, add a source. Then, from the list of destinations, select Matomo.
  2. Assign a name to the destination and click on Continue.

Connection settings

To successfully configure Matomo as a destination, you will need to configure the following settings:

Matomo connection settings
  • Server URL: Enter your server URL mentioned under the JavaScript Tracking Code section in Matomo dashboard.
  • Site Id: Enter your site Id mentioned under the JavaScript Tracking Code section in Matomo dashboard.
Refer to the FAQ section below for more information on finding the Server URL and Site Id.

Event settings

Matomo connection settings Matomo connection settings Matomo connection settings
  • Mapping to trigger the Matomo Goal ID for the respective Events: Enter the Event Name and the Goal Id to be triggered when that event is called.
You can specify multiple Goal Id's for one Event Name and vice versa.
  • Mapping to trigger the Matomo standard events for the respective Events: Enter the event name and pick the standard event from the dropdown to be triggered when that event is called.
You can specify multiple Standard Events for one Event Name and vice versa.
  • Track All Content Impressions: Enable this setting to scan the entire DOM for all content blocks and track all impressions, once the DOM ready event has been triggered.
  • Track Visible Content Impressions: Enable this setting to scan the entire DOM for all content blocks as soon as the page is loaded. It tracks an impression only if a content block is actually visible. If enabled, also enter the following:
    • Check on Scroll: Checks whether the previously hidden content blocks became visible meanwhile after a scroll and if yes, then tracks the impression. It is enabled by default.
    • Time interval in ms: Enter the time to rescan the entire DOM for new content impressions. By default, the rescan is done every 750ms. To disable it, pass the value as 0.
  • Log All Content Blocks On Page: Enable this setting to log all the content blocks found within a page to the console. This is useful while debugging/testing the content tracking.
  • Enable Heart Beat Timer: Enable this setting to install a heart beat timer to send additional requests to Matomo to measure the time spent in the visit. These requests will be sent only when the user's tab is active and in focus and will not track additional actions or pageviews. If enabled, also enter the following:
    • Active Time in seconds: Enter the time interval after which a ping request should be sent. The default value is 15 seconds, meaning that if a page is viewed for at least 15 seconds, only then a ping request will be sent.
  • Enable Link Tracking: Enable this setting to install link tracking on all the applicable link elements.
  • Disable Performance Tracking: Enable this setting to disable the page performance tracking.
  • Enable Cross Domain Linking: Enable this setting to enable cross domain linking. Refer to the Matomo document for more information.
  • Set Cross Domain Linking Timeout: Enable this setting to set the cross domain linking timeout (in seconds). If enabled, also enter the following:
    • Timeout: Enter the timeout interval. By default, the two visits across domains are linked together when the link is clicked and the page is loaded within a 180 seconds timeout window.
  • Get Cross Domain Linking Url Parameter: Enable this setting to get the query parameter to append to links to handle cross domain linking. Refer to the Matomo document for more information.
  • Disable Browser Feature Detection: Enable this setting to disable the browser feature detection. Refer to the Matomo document for more information.

Web device mode settings

Matomo connection settings
  • Use device mode to send events: As this is a device mode-only destination, this setting is enabled by default and cannot be disabled.

Identify

RudderStack sets the ID value in the cache to the userId or anonymousId present in the identify call.

A sample identify call is shown below:

rudderanalytics.identify("1hKOmRA4GRlm");

The following table lists the RudderStack and Matomo property to set the userId in the identify call:

RudderStack propertyMatomo propertyPresenceMatomo Method
userId/anonymousIduserIdRequired_paq.push(["setUserId","user_id"])

Track

The track method lets you capture user events along with the properties associated with them.

A sample track call is shown below:

rudderanalytics.track("Order Completed",{
"category": "Orders",
"action": "Pass",
"value": 15
});

Generic events

RudderStack sends a generic track call which is a not a standard event or an e-commerce event as a Matomo trackEvent event.

The following table lists the property mappings between RudderStack and Matomo for trackEvent:

RudderStack propertyMatomo propertyPresence
properties.categorycategoryRequired
properties.actionactionRequired
eventnameOptional
properties.valuevalueOptional

Standard events

For RudderStack to send an event as a standard Matomo event, you need to specify the event mapping under the Mapping to trigger the Matomo standard events for the respective Events setting in the RudderStack dashboard. For more information, refer to the Event settings section above.

RudderStack supports the following Matomo standard events:

RudderStack first verifies if an event is mapped to a standard Matomo event. If so, it sends the event to Matomo with some specific properties, as listed in the following sections.

These properties should be present in the events for RudderStack to successfully send them to Matomo.

Ping

Use this event to send a ping request.

The ping requests do not track new actions. Matomo ignores these requests if they're sent after a standard visit length.

Track Content Impressions

Use this event to track a content impression using the specified values.

RudderStack maps the following event properties to the Matomo standard event properties:

RudderStack propertyMatomo propertyDescription
properties.contentNamecontentNameRepresents a content block visible in the reports. One name can represent different content pieces.
properties.contentPiececontentPieceActual displayed content, for example, path to a video, image, etc.
properties.contentTargetcontentTargetURL of the landing page where the user was directed to after interacting with the block.

Track Content Impressions Within Node

Use this event to scan a given DOM node and its associated children for content blocks and track impressions for them, if not done already.

RudderStack maps the following event properties to the Matomo standard event properties:

RudderStack propertyMatomo property
properties.domId/ properties.dom_iddomId

Track Content Interaction

Use this event to track a content interaction with the specified values.

RudderStack maps the following event properties to the Matomo standard event properties:

RudderStack propertyMatomo property
properties.contentInteractioncontentInteraction
properties.contentNamecontentName
properties.contentPiececontentPiece
properties.contentTargetcontentTarget

Track Content Interaction Node

Use this event to track the interaction with a given DOM node or a content block.

RudderStack maps the following event properties to the Matomo standard event properties:

RudderStack propertyMatomo property
properties.domId/ properties.dom_iddomId
properties.contentInteractioncontentInteraction

Use this event to log a click from your code.

RudderStack maps the following event properties to the Matomo standard event properties:

RudderStack propertyMatomo propertyDescription
properties.url/ message.context.page.urlurlThe full URL to be tracked as a click.
properties.linkTypelinkTypeDefines the link type. Can either be link for an outlink or download for the download link type.

Use this event to track an internal site search for a given keyword with an optional category and specifying the optional search results count in the page.

RudderStack maps the following event properties to the Matomo standard event properties:

RudderStack propertyMatomo property
properties.keyword/properties.search/message.context.page.searchkeyword
properties.categorycategory
properties.resultsCountresultsCount

E-commerce events

RudderStack supports and maps the following e-commerce events to the corresponding Matomo e-commerce events:

RudderStack EventMatomo Event
Product ViewedsetEcommerceView
Product AddedaddEcommerceItem
Product RemovedremoveEcommerceItem
Order CompletedtrackEcommerceOrder
Cart ClearedclearEcommerceCart
Update CarttrackEcommerceCartUpdate

For the above-mentioned events, you can also send specific properties as mentioned in the following sections.

Product Viewed

RudderStack maps the Product Viewed event to setEcommerceView. The following event properties are mapped to the Matomo properties:

RudderStack propertyMatomo propertyPresence
properties.sku/properties.product_idproductSKURequired
properties.nameproductNameRequired
properties.categorycategoryNameRequired
properties.price (Multiplied by quantity)priceRequired
You can view the Product Viewed event in the Matomo dashboard only when it is followed by a page call.

Product Added

RudderStack maps the Product Added event name to addEcommerceItem. The following event properties are mapped to the Matomo properties:

RudderStack propertyMatomo propertyPresence
properties.sku/properties.product_idproductSKURequired
properties.nameproductNameOptional
properties.categorycategoryNameOptional
properties.price (Multiplied by quantity)priceOptional
properties.quantityquantityOptional
You can view the Product Added event in the Matomo dashboard only when it is followed by an Update Cart or Order Completed event.

Product Removed

RudderStack maps the Product Removed event name to removeEcommerceItem. The following event properties are mapped to the Matomo properties:

RudderStack propertyMatomo propertyPresence
properties.sku/properties.product_idproductSKURequired
You can view the Product Removed event in the Matomo dashboard only when it is followed by an Update Cart or Order Completed event.

Order Completed

RudderStack maps the Order Completed event name to trackEcommerceOrder. The following event properties are mapped to the Matomo properties:

RudderStack propertyMatomo propertyPresence
properties.order_id/properties.orderIdorderIdRequired
properties.total/properties.revenuegrandTotalRequired
properties.subtotalsubtotalOptional
properties.taxtaxOptional
properties.shippingshippingOptional
properties.discountdiscountOptional
grandTotal is not a default property in the Order Completed event and needs to be provided by the user. If not provided, RudderStack calculates it manually by iterating through the products array, as shown below:
grandTotal = products[0].price * products[0].quantity + …
grandTotal += tax + shipping;

Similarly, subtotal is calculated as the total value of all sales, excluding shipping and tax.

Update Cart

Although Update Cart is not a standard RudderStack E-commerce Event, you can still send this event to update your cart and view the items that are currently present in it.

RudderStack also maps the Update Cart event name to trackEcommerceCartUpdate. The following event properties are mapped to the Matomo properties:

RudderStack propertyMatomo propertyPresence
properties.total/properties.revenuegrandTotalRequired

Page

The page call lets you record your website's page views with any additional relevant information about the viewed page.

A sample page call is shown below:

rudderanalytics.page("home","games");
RudderStack does not consider any parameters inside the page call and simply calls the trackPageView event for each page call.

Custom dimensions

Custom dimensions can be used to track any information related to any action or visitors.

You can send the custom dimensions to Matomo only through the track calls.

RudderStack provides customDimension field which can be used inside the integrations object, as shown below:

{
integrations: {
Matomo: {
customDimension: [{
dimensionId: <dimension_ID>,
dimensionValue: <dimension_value>
},
{
dimensionId: 1,
dimensionValue: ENTERPRISE
}
]
}
}
}
Refer to the Matomo help guide to know about the data limitations for custom dimensions in Matomo.
RudderStack does not support sending custom variables to Matomo. Matomo recommends using custom dimensions instead. For more information, refer to this Matomo page.

FAQ

Where can I find the Server URL and Site Id?

To find the Matomo Server URL and Site Id:

  1. Log into your Matomo dashboard.
  2. Go to Settings > Website > Tracking Code.
  3. Under JavaScript Tracking Code section, you will find the below:
Matomo dashboard

Here, the server URL: https://rudderstacktest.matomo.cloud/ and site Id: 1


Contact us

For more information on the topics covered on this page, email us or start a conversation in our Slack community.

Contents