Matomo

📘

This integration is currently in beta. Contact your MetaRouter support team to get started.

What Is Matomo?

Matomo is an open-source web analytics platform that helps businesses measure visits, page views, and conversion activity across their websites. It provides detailed reporting on visitor behavior, acquisition channels, and ecommerce performance while giving organizations full ownership of their data. Its Tracking HTTP API allows server-side events to be sent directly to a Matomo instance for measurement and attribution.


Product Type: Analytics

Integration Type: Starter Kit

Event Source Type: Web

Event Scope: Full-Funnel Events


Capabilities

  • Sends server-side page, product, and e-commerce events directly to Matomo via the Tracking HTTP API.
  • Delivers events in bulk POST batches of up to 500 events per request.
  • Preserves visitor identity across events using a consistent visitor ID and user ID.
  • Records the original event timestamp so batching delays do not affect when a hit is registered.
  • Supports e-commerce measurement including cart and order lifecycle events.

Considerations

  • A visitor ID (_id) is derived from anonymousId as a 16-character hexadecimal string, and uid carries the customer's userId. Identity is preserved across events through consistent _id and uid values.
  • The cdt field sends the original event timestamp so batching delays and retries do not skew when a hit is recorded.
  • token_auth is required for IP, datetime, and geo overrides. cip (visitor IP) and city are always authentication-gated, and cdt is gated only when the event is older than 24 hours (backfill or replay).
  • Without a valid token, Matomo counts every event that includes an authentication-gated field as invalid. If a valid token cannot be acquired, remove cip and city (and cdt if events can be older than 24 hours) from the playbook.
  • E-commerce must be enabled for the website in Matomo (Administration → Websites → Ecommerce: "Yes, an Ecommerce shop"). If it is not enabled, every e-commerce hit (Cart Viewed, Checkout Started, Order Completed) is rejected as invalid. Page views are unaffected.
  • Orders are de-duplicated by ec_id. Re-sending the same order ID for a visitor is rejected as invalid to prevent double-counting. This is expected behavior, and each order needs a unique order_id.
  • An item SKU is required on each product in ec_items. The kit falls back from sku to product_id. A product with neither produces a malformed item, so ensure products carry an identifier.
  • Checkout Started and Cart Viewed are cart updates, so order-only details (tax, shipping, discount, order ID) are not carried on them, only ec_items and the cart total. Matomo keeps only the latest cart snapshot per visit.
  • Geo override is city only. Region, country, latitude, and longitude are not mapped, though IP-based geolocation via cip still applies.
  • A 200 response with {"tracked":0,"invalid":N} is still treated as delivered by the pipeline, so individual rejected hits do not surface as errors.
  • Self-hosted Matomo instances have no rate limits.

Limitations

  • No-result site searches are not tracked.
  • Product Added and Product Removed events lack the full-cart data that Matomo's cart update requires, so they are not sent as e-commerce cart updates.

Starter Kit Setup Guide

1. Gather Credentials

  • Ask vendor representatives for the following credentials:
    • DOMAIN_URL: The base URL of your Matomo instance (self-hosted domain or Matomo Cloud domain).
    • TOKEN_AUTH: A 32-character authorization key from a Matomo user with write or admin permission on the target website. Required for IP, datetime, and geo overrides.

2. Add a Matomo Integration

  • From the integration library, add a Matomo integration. Then, fill out the Connection Parameters:
Connection ParameterDescription
DOMAIN_URLBase URL of your Matomo instance. The tracking endpoint is formed as DOMAIN_URL/matomo.php.
TOKEN_AUTHOptional 32-character token authenticating requests that use IP, datetime, or geo overrides.

3. Configure Event Mapping

  • MetaRouter provides all of the event mappings that Matomo integrations typically require. You may add custom events, parameters, or mappings in accordance with Matomo's API documentation.

4. Deploy to Pipeline

  • In the Pipelines tab, add your Matomo integration.
  • Select the correct integration revision.
  • Click Add Integration to finalize deployment.

Event Mappings

Global

Global mappings will be applied to all events. If your parameter names do not match the Expected Inputs provided, you will need to overwrite the Inputs provided with your own.

Output KeyDescriptionExpected Input
rec RequiredString: Enables tracking request processing. Must be set to 1.Enrichment – '1'
apivString: Tracking API version, currently always 1.Enrichment – '1'
idsite RequiredString: The ID of the website being tracked.$$SITE_ID$$
urlString: Full URL for the current action.context.page.url
urlrefString: Full HTTP referrer URL.context.page.referrer
uaString: Override value for the user-agent header.context.userAgent
uidString: User ID identifying the logged-in user.userId
cipString: Override value for the visitor IP. Requires token_auth.context.ip
cityString: Override value for the visitor's city. Requires token_auth.traits.address.city
langString: Override value for the Accept-Language header.context.locale
randString: Random value to prevent request caching.messageId
_idString: 16-character hexadecimal visitor ID.Expression – first 16 chars of anonymousId with dashes removed
cdtString: Override datetime of the request (event timestamp, UTC). Requires token_auth when older than 24h.Expression – converts event timestamp to epoch seconds

Event Specific

Page

Output KeyDescriptionExpected Input
action_nameString: Title of the page action being tracked.context.page.title

Products Searched

Output KeyDescriptionExpected Input
searchString: Site search keyword. Tracks the request as a site search.properties.query

Product List Viewed

Output KeyDescriptionExpected Input
_pkcString: Category of the product list being viewed.properties.category

Product Viewed

Output KeyDescriptionExpected Input
_pksString: SKU of the product being viewed.Expression – properties.sku or properties.product_id
_pknString: Name of the product being viewed.properties.name
_pkcString: Category of the product being viewed.properties.category
_pkpFloat: Price of the product being viewed.properties.price

Cart Viewed

Output KeyDescriptionExpected Input
idgoal RequiredString: Set to 0 to track an ecommerce cart update.Enrichment – '0'
ec_itemsArray: Cart items as [sku, name, category, price, quantity] rows.Expression – maps properties.products
revenueFloat: Total value of items in the cart.Expression – totals properties.products

Checkout Started

Output KeyDescriptionExpected Input
idgoal RequiredString: Set to 0 to track an ecommerce cart update.Enrichment – '0'
revenueFloat: Order revenue value.properties.revenue
ec_itemsArray: Cart items as [sku, name, category, price, quantity] rows.Expression – maps properties.products

Order Completed

Output KeyDescriptionExpected Input
idgoal RequiredString: Set to 0 to track an ecommerce order.Enrichment – '0'
ec_id RequiredString: Unique ecommerce order identifier used for de-duplication.properties.order_id
revenue RequiredFloat: Grand total for the ecommerce order.properties.total
ec_stFloat: Order subtotal, excluding shipping.properties.revenue
ec_txFloat: Tax amount of the order.properties.tax
ec_shFloat: Shipping cost of the order.properties.shipping
ec_dtFloat: Discount offered on the order.properties.discount
ec_itemsArray: Order items as [sku, name, category, price, quantity] rows.Expression – maps properties.products

Promotion Viewed

Output KeyDescriptionExpected Input
c_nString: Name of the content or promotion.properties.name
c_pString: Content piece, such as the creative.properties.creative

Promotion Clicked

Output KeyDescriptionExpected Input
c_iString: Name of the content interaction.Enrichment – 'click'
c_nString: Name of the content or promotion.properties.name
c_pString: Content piece, such as the creative.properties.creative

Required & Recommended Identifiers

These identifiers must be mapped to Matomo in order for successful user matching to occur. Without these IDs, any events sent to Matomo may not be accurately reflected in reporting.

AttributeExampleSync Injector Required?
idsite Requiredmy-site-idNo
_id Recommendedaf344a398df83874No
uid Recommendeduser_12345No
ec_id Requiredorder_98765No

Integration Validation

Success is judged by HTTP status only. A 200 response with {"tracked":0,"invalid":N} is still treated as delivered by the pipeline, so individual rejected hits do not surface as errors. Because of this, confirm data is landing in Matomo rather than relying on the pipeline status alone.

To verify tracking in the Matomo UI:

  • Open Visitors → Real-time to watch visits, page views, and actions arrive as they are sent. This report shows recent activity and refreshes automatically, making it the fastest way to confirm events are being received.
  • Open Visitors → Visits Log to inspect individual visits and their actions, and confirm event and page detail appears as expected. Visitor IP and Visitor ID are shown only when you are logged in.
  • For ecommerce events, check the Ecommerce reports (such as Ecommerce Log and Ecommerce Orders) to confirm carts and orders are recorded. Ensure Ecommerce is enabled for the website first (Administration → Websites → Ecommerce), or ecommerce hits will be rejected.
  • Note that aggregated reports for periods including today are processed on a delay, so use the Real-time and Visits Log reports for immediate confirmation.

If events are not appearing as expected, coordinate with your Matomo representative to confirm data is being received and processed on their end, including reviewing invalid hit counts returned in tracking responses.


Additional Matomo Documentation