Matomo

Send your event data from RudderStack to Matomo.

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.

Connection compatibility

Destination info
  • Status: Generally Available
  • Supported sources: Web
  • Refer to it as MATOMO in the Integrations object.

Connection modes
SourceCloud modeDevice modeHybrid mode
Webnot supportedsupportednot supported
Supported message types
SourceIdentifyPageTrackScreenGroupAlias
Device mode
Websupportedsupportedsupportednot supportednot supportednot supported
info

In the web device mode integration, that is, using JavaScript SDK as a source, RudderStack loads the Matomo native SDK from thehttps://cdn.matomo.cloud/ domain.

Based on your website’s content security policy, you might need to allowlist this domain to load the Matomo SDK successfully.

Get started

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 Continue.

Connection settings

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

  • Matomo Version: Choose the Matomo version from the dropdown:

    • Premise Version: Choose this option if you have an on-premise Matomo setup.
      • Premise URL: Enter the SDK’s CDN URL in this field.
    • Cloud Version: Choose this option if you are using Matomo Cloud.
      • 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.

info
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.
success
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.
success
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 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 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

warning
This destination does not strictly adhere to the RudderStack Ecommerce Event Spec.

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 ecommerce 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

warning
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.

warning
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.

info
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

Ecommerce events

RudderStack supports and maps the following ecommerce events to the corresponding Matomo ecommerce 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](https://developer.matomo.org/api-reference/tracking-javascript#ecommerce:~:text=click%20here.-,setEcommerceView,-(%20productSKU%2C%20productName%2C%20categoryName). 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
info
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](https://developer.matomo.org/api-reference/tracking-javascript#ecommerce:~:text=category%20page%20view.-,addEcommerceItem,-(%20productSKU%2C%20%5BproductName%5D%2C%20%5BproductCategory). 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
info
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
info
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](https://developer.matomo.org/api-reference/tracking-javascript#ecommerce:~:text=from%20the%20cart.-,trackEcommerceOrder,-(%20orderId%2C%20grandTotal%2C%20%5BsubTotal). 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
info

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

info
Although Update Cart is not a standard RudderStack Ecommerce 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");
info
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.

warning
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
        }
      ]
    }
  }
}
info
Refer to the Matomo help guide to know about the data limitations for custom dimensions in Matomo.
info
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


Questions? Contact us by email or on Slack