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
RudderStack supports sending event data to Matomo via the following connection modes:
Connection Mode | Web | Mobile | Server |
---|---|---|---|
Device mode | Supported | - | - |
Cloud mode | - | - | - |
https://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.Once you have confirmed that the source platform supports sending events to Matomo, follow these steps:
- From your RudderStack dashboard, add a source. Then, from the list of destinations, select Matomo.
- Assign a name to the destination and click Continue.
Connection settings
To successfully configure Matomo as a destination, you will need to configure the following 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.
Event 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.
- 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.
- 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
- 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 property | Matomo property | Presence | Matomo Method |
---|---|---|---|
userId /anonymousId | userId | Required | _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 ecommerce event as a Matomo trackEvent
event.
The following table lists the property mappings between RudderStack and Matomo for trackEvent
:
RudderStack property | Matomo property | Presence |
---|---|---|
properties.category | category | Required |
properties.action | action | Required |
event | name | Optional |
properties.value | value | Optional |
Standard events
RudderStack supports the following Matomo standard events:
- Ping
- Track Content Impressions
- Track Content Impressions Within Node
- Track Content Interaction
- Track Content Interaction Node
- Track Link
- Track Site Search
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.
Ping
Use this event to send a ping request.
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 property | Matomo property | Description |
---|---|---|
properties.contentName | contentName | Represents a content block visible in the reports. One name can represent different content pieces. |
properties.contentPiece | contentPiece | Actual displayed content, for example, path to a video, image, etc. |
properties.contentTarget | contentTarget | URL 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 property | Matomo property |
---|---|
properties.domId / properties.dom_id | domId |
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 property | Matomo property |
---|---|
properties.contentInteraction | contentInteraction |
properties.contentName | contentName |
properties.contentPiece | contentPiece |
properties.contentTarget | contentTarget |
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 property | Matomo property |
---|---|
properties.domId / properties.dom_id | domId |
properties.contentInteraction | contentInteraction |
Track Link
Use this event to log a click from your code.
RudderStack maps the following event properties to the Matomo standard event properties:
RudderStack property | Matomo property | Description |
---|---|---|
properties.url / message.context.page.url | url | The full URL to be tracked as a click. |
properties.linkType | linkType | Defines the link type. Can either be link for an outlink or download for the download link type. |
Track Site Search
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 property | Matomo property |
---|---|
properties.keyword /properties.search /message.context.page.search | keyword |
properties.category | category |
properties.resultsCount | resultsCount |
Ecommerce events
RudderStack supports and maps the following ecommerce events to the corresponding Matomo ecommerce events:
RudderStack Event | Matomo Event |
---|---|
Product Viewed | setEcommerceView |
Product Added | addEcommerceItem |
Product Removed | removeEcommerceItem |
Order Completed | trackEcommerceOrder |
Cart Cleared | clearEcommerceCart |
Update Cart | trackEcommerceCartUpdate |
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 property | Matomo property | Presence |
---|---|---|
properties.sku /properties.product_id | productSKU | Required |
properties.name | productName | Required |
properties.category | categoryName | Required |
properties.price (Multiplied by quantity) | price | Required |
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 property | Matomo property | Presence |
---|---|---|
properties.sku /properties.product_id | productSKU | Required |
properties.name | productName | Optional |
properties.category | categoryName | Optional |
properties.price (Multiplied by quantity) | price | Optional |
properties.quantity | quantity | Optional |
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 property | Matomo property | Presence |
---|---|---|
properties.sku /properties.product_id | productSKU | Required |
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 property | Matomo property | Presence |
---|---|---|
properties.order_id /properties.orderId | orderId | Required |
properties.total /properties.revenue | grandTotal | Required |
properties.subtotal | subtotal | Optional |
properties.tax | tax | Optional |
properties.shipping | shipping | Optional |
properties.discount | discount | Optional |
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
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 property | Matomo property | Presence |
---|---|---|
properties.total/properties.revenue | grandTotal | Required |
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");
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.
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 } ] } }}
FAQ
Where can I find the Server URL and Site Id?
To find the Matomo Server URL and Site Id:
- Log into your Matomo dashboard.
- Go to Settings > Website > Tracking Code.
- Under JavaScript Tracking Code section, you will find the below:
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.