> Part of the walkerOS documentation. Project overview and full index: <https://www.walkeros.io/llms.txt>

# Matomo

[Server](#)[ Source code](https://github.com/elbwalker/walkerOS/tree/main/packages/server/destinations/matomo)[ Package](https://www.npmjs.com/package/@walkeros/server-destination-matomo)

Send walker.js events to your [Matomo](https://matomo.org/) from the server, with visitors and location as matomo.js reports them. The destination turns each event into Matomo [HTTP Tracking API](https://developer.matomo.org/api-reference/tracking-api) requests and sends them as one bulk request, so walker.js stays the only script on your pages.

With walker.js as the only script and consent granted, these work as they do with matomo.js: visits, page views, the Visits Log, new and returning visitors, ecommerce, goals, events, site search, content and custom dimensions. Location and device work too once you set `ip`, `credentials.token` and `userAgent`; without them Matomo sees the collector's. Matomo computes time on page from consecutive page views, so the last page of a visit shows 0 s. The destination turns a `page hide` event with `data.total` into Matomo's heartbeat: the last page of a visit gets its time on page only on Matomo 6; Matomo 5 shows it as 0 s and counts the heartbeat as visit duration. No walkerOS source sends a `page hide` event yet, see [time on page](#time-on-page). Product views need your product pages marked, see [product views](#product-views). Heatmaps, session recordings, media, form analytics and A/B tests run inside matomo.js and do not work from a server, see [Matomo's heatmap requirements](https://matomo.org/faq/heatmap-session-recording/matomo-heatmap-requirements/).

Where this fits

Matomo is a **server destination** in the walkerOS flow:

Builds Tracking API requests from each event and sends them to your Matomo in one bulk POST request, with the visitor ID from the device ID.

## Before you start on Matomo 6[​](#before-you-start-on-matomo-6 "Direct link to Before you start on Matomo 6")

Matomo 6 switches on Tracking Spam Prevention by default. It excludes hits from the IP ranges of cloud providers (AWS, Google Cloud, Azure, and providers such as Scaleway and Hetzner by their GeoIP name), which is where a collector usually runs, and still answers that it tracked them. Add your collector's IP addresses to its IP allow list, or send the visitor's IP with `ip` and `credentials.token` (see [IP, location and device](#ip-location-and-device)), and set `userAgent`. Matomo explains the options in its [Tracking Spam Prevention FAQ](https://matomo.org/faq/how-to/block-spam-and-bot-traffic-with-tracking-spam-prevention/).

## Installation[​](#installation "Direct link to Installation")

```bash
npm install @walkeros/collector @walkeros/server-destination-matomo
```

* Integrated
* Bundled

```typescript
import { startFlow } from '@walkeros/collector';
import destinationMatomo from '@walkeros/server-destination-matomo';

await startFlow({
  destinations: {
    matomo: {
      code: destinationMatomo,
      config: {
        settings: {
          url: 'https://matomo.example.com/',
          siteId: '1',
        },
      },
    },
  },
});
```

A complete `flow.json` with this destination:

```json
{
  "version": 4,
  "flows": {
    "default": {
      "config": {
        "platform": "server"
      },
      "destinations": {
        "matomo": {
          "package": "@walkeros/server-destination-matomo",
          "config": {
            "settings": {
              "url": "https://matomo.example.com/",
              "siteId": "1"
            }
          }
        }
      }
    }
  }
}
```

[See bundled mode setup](https://www.walkeros.io/docs/getting-started/modes/bundled.md) | [CLI reference](https://www.walkeros.io/docs/apps/cli.md)

## Configuration[​](#configuration "Direct link to Configuration")

This destination uses the standard destination config wrapper (consent, data, env, id, ...). For the shared fields see [destination configuration](https://www.walkeros.io/docs/destinations.md#configuration). Package-specific fields live under `config.settings` and are listed below.

## Settings[​](#settings "Direct link to Settings")

| Property           | Type                            | Description                                                                                                                                                                                                                                                                      | More |
| ------------------ | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- |
| `url*`             | `string \| any`                 | Base URL of your Matomo, normalized to one trailing slash; hits go to \<url>matomo.php (like https\://matomo.example.com/). A string is the URL itself; a mapping value config resolves per event against { ingest, event }                                                      |      |
| `siteId*`          | `any \| integer`                | Matomo site ID, a positive integer, sent as idsite. A string or number is the ID itself; a mapping value config resolves per event against { ingest, event }, so one step can serve several sites                                                                                |      |
| `ip`               | `any \| boolean`                | Visitor IP, sent as cip; needs credentials.token. Resolves against { ingest, event }, like \["ingest.ip", "event.user.ip"]. No default: Matomo then sees the collector IP                                                                                                        |      |
| `userAgent`        | `any \| boolean`                | User agent, sent as ua. Resolves against { ingest, event }, like \["ingest.userAgent", "event.user.userAgent"]. No default: Matomo then sees the collector user agent                                                                                                            |      |
| `language`         | `any \| boolean`                | Accept-Language value, sent as lang. Resolves against { ingest, event }. Default: \["ingest.language", "event.user.language"]. false switches it off.                                                                                                                            |      |
| `pageUrl`          | `any \| boolean`                | Page URL, sent as url. Resolves against { ingest, event }. Default: "event.source.url". false switches it off.                                                                                                                                                                   |      |
| `referrer`         | `any \| boolean`                | Referrer URL, sent as urlref. Resolves against { ingest, event }. Default: "event.source.referrer". false switches it off.                                                                                                                                                       |      |
| `visitorId`        | `any \| boolean`                | Visitor ID, sent as cid, the forced visitor ID Matomo matches visitors by; a 16-character lowercase hex value passes through, anything else is hashed to 16 hex (sha256). Default: event.user.device. false switches it off                                                      |      |
| `userId`           | `any \| boolean`                | User ID, sent as uid. No default. With uid Matomo uses a hash of the user ID as the visitor ID instead of cid and may join a first identified hit to another visitor visit by its fingerprint, so set it together with ip, credentials.token and userAgent. Like "event.user.id" |      |
| `screenSize`       | `any \| boolean`                | Screen size, sent as res as WxH (like 1920x1080); any other value is not sent and reported. Resolves against { ingest, event }. Default: "event.user.screenSize". false switches it off.                                                                                         |      |
| `pageViewId`       | `any \| boolean`                | Page view ID, sent as pv\_id (first 6 hex characters, else a 6-character hash). Resolves against { ingest, event }. Default: "event.source.trace", only for web events whose trace differs from the server collector trace. false switches it off.                               |      |
| `timestamp`        | `any \| boolean`                | Event time in milliseconds, sent as cdt in UNIX seconds; a cdt older than 24 hours needs credentials.token, else Matomo refuses the request. Resolves against { ingest, event }. Default: "event.timestamp". false lets Matomo use the receive time.                             |      |
| `customDimensions` | `Record<string, Mapping.Value>` | Custom dimensions applied to every hit, keyed by bare dimension id (like { "1": "data.userType" }). Each value is resolved per event. Rule-level customDimensions win per key.                                                                                                   |      |

\* Required fields

## Mapping[​](#mapping "Direct link to Mapping")

Per-event rules under `config.mapping`. For the standard rule fields (consent, condition, data, batch, name, policy) see [mapping](https://www.walkeros.io/docs/mapping.md).

| Property           | Type                            | Description                                                                                                                                                                                        | More |
| ------------------ | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- |
| `goalId`           | `string \| number`              | Matomo goal ID, a positive integer; adds a goal hit to the same request                                                                                                                            |      |
| `goalValue`        | `Mapping.Value`                 |                                                                                                                                                                                                    |      |
| `customDimensions` | `Record<string, Mapping.Value>` | Custom dimensions for this rule, keyed by bare dimension id. Values are mapping values resolved against the event (like { "1": "data.size" }). Wins per key over the destination customDimensions. |      |
| `items`            | `Mapping.Value`                 |                                                                                                                                                                                                    |      |
| `ecommerceView`    | `Mapping.Value`                 |                                                                                                                                                                                                    |      |

## Examples

### Cart view

A cart view maps to trackEcommerceCartUpdate with the cart total as revenue and the cart products as ec\_items.

Event

```json
{
  "name": "cart view",
  "data": {
    "currency": "EUR",
    "value": 840
  },
  "context": {
    "shopping": [
      "cart",
      0
    ]
  },
  "globals": {
    "pagegroup": "shop"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "product",
      "data": {
        "id": "ers",
        "name": "Everyday Ruck Snack",
        "color": "black",
        "size": "l",
        "price": 420,
        "quantity": 2
      },
      "context": {
        "shopping": [
          "cart",
          0
        ]
      },
      "nested": []
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "17fc82ac689238a0",
  "trigger": "load",
  "entity": "cart",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "name": "trackEcommerceCartUpdate",
  "data": {
    "set": [
      "data.value"
    ]
  },
  "settings": {
    "items": {
      "loop": [
        "nested",
        {
          "condition": {
            "$code": "e=>\"object\"==typeof e&&null!==e&&\"entity\"in e&&\"product\"===e.entity"
          },
          "map": {
            "sku": "data.id",
            "name": "data.name",
            "category": "data.category",
            "price": "data.price",
            "quantity": "data.quantity"
          }
        }
      ]
    }
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&idgoal=0&revenue=840&ec_items=%5B%5B%22ers%22%2C%22Everyday+Ruck+Snack%22%2C%22%22%2C420%2C2%5D%5D&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

### Order complete

A completed order maps to trackEcommerceOrder with its order ID, grand total, subtotal, tax and shipping, and the ordered products as ec\_items.

Event

```json
{
  "name": "order complete",
  "data": {
    "id": "0rd3r1d",
    "currency": "EUR",
    "value": 462,
    "tax": 73.76,
    "shipping": 5.22,
    "total": 467.22
  },
  "context": {
    "shopping": [
      "complete",
      0
    ]
  },
  "globals": {
    "pagegroup": "shop"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "product",
      "data": {
        "id": "ers",
        "name": "Everyday Ruck Snack",
        "color": "black",
        "size": "l",
        "price": 420
      },
      "context": {
        "shopping": [
          "complete",
          0
        ]
      },
      "nested": []
    },
    {
      "entity": "product",
      "data": {
        "id": "cc",
        "name": "Cool Cap",
        "size": "one size",
        "price": 42
      },
      "context": {
        "shopping": [
          "complete",
          0
        ]
      },
      "nested": []
    },
    {
      "entity": "gift",
      "data": {
        "name": "Surprise"
      },
      "context": {
        "shopping": [
          "complete",
          0
        ]
      },
      "nested": []
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "235d0d7bd7a213f2",
  "trigger": "load",
  "entity": "order",
  "action": "complete",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "name": "trackEcommerceOrder",
  "data": {
    "set": [
      "data.id",
      "data.total",
      "data.value",
      "data.tax",
      "data.shipping"
    ]
  },
  "settings": {
    "items": {
      "loop": [
        "nested",
        {
          "condition": {
            "$code": "e=>\"object\"==typeof e&&null!==e&&\"entity\"in e&&\"product\"===e.entity"
          },
          "map": {
            "sku": "data.id",
            "name": "data.name",
            "category": "data.category",
            "price": "data.price",
            "quantity": "data.quantity"
          }
        }
      ]
    }
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&idgoal=0&ec_id=0rd3r1d&revenue=467.22&ec_st=462&ec_tx=73.76&ec_sh=5.22&ec_items=%5B%5B%22ers%22%2C%22Everyday+Ruck+Snack%22%2C%22%22%2C420%2C1%5D%2C%5B%22cc%22%2C%22Cool+Cap%22%2C%22%22%2C42%2C1%5D%5D&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

### Page view

A page view becomes a trackPageView hit with the page title as action\_name and the page and visitor context.

Event

```json
{
  "name": "page view",
  "data": {
    "domain": "www.example.com",
    "title": "walkerOS documentation",
    "referrer": "https://www.walkeros.io/",
    "search": "?foo=bar",
    "hash": "#hash",
    "id": "/docs/"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "pagegroup": "docs"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "f0cc5f6fec3d8eeb",
  "trigger": "load",
  "entity": "page",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&action_name=walkerOS+documentation&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

### Product view

A product view becomes the product page's page view with the product fields, as Matomo records it; the page's plain page view is skipped (pageViewOnProductPage).

Event

```json
{
  "name": "product view",
  "data": {
    "id": "ers",
    "name": "Everyday Ruck Snack",
    "category": "Backpacks",
    "color": "black",
    "size": "l",
    "price": 420,
    "currency": "EUR"
  },
  "context": {
    "shopping": [
      "detail",
      0
    ]
  },
  "globals": {
    "pagegroup": "shop"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [],
  "consent": {
    "functional": true
  },
  "id": "db22fb16c70f663d",
  "trigger": "load",
  "entity": "product",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "name": "trackPageView",
  "data": {
    "set": [
      "data.name"
    ]
  },
  "settings": {
    "ecommerceView": {
      "map": {
        "sku": "data.id",
        "name": "data.name",
        "category": "data.category",
        "price": "data.price"
      }
    }
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&action_name=Everyday+Ruck+Snack&_pks=ers&_pkn=Everyday+Ruck+Snack&_pkc=Backpacks&_pkp=420&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

## When it fails

* **Cart view without input**: A cart view event without the data its rule reads cannot become a Tracking API request: the push fails with missing-input instead of counting as delivered. Reported as `failed` with code `missing-input`.
* **Content impression without input**: A teaser visible event without the data its rule reads cannot become a Tracking API request: the push fails with missing-input instead of counting as delivered. Reported as `failed` with code `missing-input`.
* **Event without a category**: Matomo needs a category and an action for trackEvent: an event whose rule resolves no category fails with missing-input instead of counting as delivered. Reported as `failed` with code `missing-input`.
* **Request refused**: Matomo answers 403: the push fails with transport and its status, and the event is not retried. Reported as `failed` with code `transport`.
* **Visitor IP without a token**: Matomo records the visitor IP (cip) only with token\_auth: an ip setting without credentials.token fails the start with config, so no event is sent until it is fixed. Reported as `failed` with code `config`.
* **Order complete without input**: A order complete event without the data its rule reads cannot become a Tracking API request: the push fails with missing-input instead of counting as delivered. Reported as `failed` with code `missing-input`.
* **Outlink without input**: A link click event without the data its rule reads cannot become a Tracking API request: the push fails with missing-input instead of counting as delivered. Reported as `failed` with code `missing-input`.
* **Matomo server error**: Matomo answers 500: the push fails with transport and its status, and the event is retried. Reported as `failed` with code `transport`.
* **Site search without input**: A search submit event without the data its rule reads cannot become a Tracking API request: the push fails with missing-input instead of counting as delivered. Reported as `failed` with code `missing-input`.
* **Unmapped event**: An event without a rule name that is not a page view or a page hide has nothing to send: the push fails with missing-input. To keep such events out without a failure, ignore them with a rule. Reported as `failed` with code `missing-input`.

## Methods[​](#methods "Direct link to Methods")

A rule's `name` is a Matomo JavaScript tracker method, and its `data` resolves to the method's arguments in matomo.js order. Use `set` to pass several arguments. A required argument is marked with `*`; when it is missing or malformed, the event fails with `missing-input`.

| Method                                                                                        | What the server sends                                                                                            |
| --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `trackPageView([customTitle])`                                                                | `action_name`, and the product fields with the rule setting `ecommerceView`, see [product views](#product-views) |
| `trackEvent(category*, action*[, name[, value]])`                                             | `e_c`, `e_a`, `e_n`, `e_v` (a number)                                                                            |
| `trackGoal(idGoal*[, customRevenue])`                                                         | `idgoal` (a positive integer), `revenue` (a number)                                                              |
| `trackSiteSearch(keyword*[, category[, resultsCount]])`                                       | `search`, `search_cat`, `search_count` (an integer)                                                              |
| `trackLink(url*, linkType*)`                                                                  | `link` or `download`, by `linkType`, which must be `"link"` or `"download"`                                      |
| `trackContentImpression(contentName*[, contentPiece[, contentTarget]])`                       | `c_n`, `c_p`, `c_t`                                                                                              |
| `trackContentInteraction(contentInteraction*, contentName*[, contentPiece[, contentTarget]])` | `c_i`, `c_n`, `c_p`, `c_t`                                                                                       |
| `trackEcommerceOrder(orderId*, grandTotal*[, subTotal[, tax[, shipping[, discount]]]])`       | `idgoal=0`, `ec_id`, `revenue`, `ec_st`, `ec_tx`, `ec_sh`, `ec_dt`, and `ec_items` from the rule setting `items` |
| `trackEcommerceCartUpdate(grandTotal*)`                                                       | `idgoal=0`, `revenue`, and `ec_items` from the rule setting `items`                                              |
| `ping([totalMs])`                                                                             | `ping=1`, and `pv_time` in whole seconds, see [time on page](#time-on-page)                                      |

A `page view` without a rule name becomes `trackPageView` with `data.title`, and a `page hide` becomes `ping` with `data.total`. Any other event needs a rule with a `name` or a `goalId`, or it fails with `missing-input`. To keep unmapped events out without a failure, ignore everything with a wildcard and map what you need:

```json
"mapping": {
  "*": { "*": { "ignore": true } },
  "page": { "view": {}, "hide": {} }
}
```

A custom event, a site search, an outlink and a content impression:

A video play maps to trackEvent with the entity as category, the action, the video title as name and the seconds watched as value.

Event

```json
{
  "name": "video play",
  "data": {
    "title": "walkerOS in 60 seconds",
    "seconds": 30
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "4275b28b7d8f1e8f",
  "trigger": "test",
  "entity": "video",
  "action": "play",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "name": "trackEvent",
  "data": {
    "set": [
      "entity",
      "action",
      "data.title",
      "data.seconds"
    ]
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&e_c=video&e_a=play&e_n=walkerOS+in+60+seconds&e_v=30&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

A search maps to trackSiteSearch with the keyword, the search category and the result count.

Event

```json
{
  "name": "search submit",
  "data": {
    "term": "rucksack",
    "category": "bags",
    "results": 12
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "cfabf39f20829dcf",
  "trigger": "test",
  "entity": "search",
  "action": "submit",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "name": "trackSiteSearch",
  "data": {
    "set": [
      "data.term",
      "data.category",
      "data.results"
    ]
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&search=rucksack&search_cat=bags&search_count=12&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

A tagged link click maps to trackLink with the link address and the type link; the server cannot track outlinks on its own.

Event

```json
{
  "name": "link click",
  "data": {
    "href": "https://github.com/elbwalker/walkerOS"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "9d2b12017466e29e",
  "trigger": "test",
  "entity": "link",
  "action": "click",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "name": "trackLink",
  "data": {
    "set": [
      "data.href",
      {
        "value": "link"
      }
    ]
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&link=https%3A%2F%2Fgithub.com%2Felbwalker%2FwalkerOS&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

A visible teaser maps to trackContentImpression with the content name, piece and target.

Event

```json
{
  "name": "teaser visible",
  "data": {
    "name": "Autumn sale",
    "piece": "banner",
    "target": "https://www.example.com/sale"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "986b98d7ad368f99",
  "trigger": "test",
  "entity": "teaser",
  "action": "visible",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "name": "trackContentImpression",
  "data": {
    "set": [
      "data.name",
      "data.piece",
      "data.target"
    ]
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&c_n=Autumn+sale&c_p=banner&c_t=https%3A%2F%2Fwww.example.com%2Fsale&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

The server cannot track outlinks and downloads on its own the way matomo.js does: tag the link and map its event to `trackLink`.

### Goals[​](#goals "Direct link to Goals")

A rule's `settings.goalId` adds a goal hit to the same request, and `settings.goalValue` is a mapping value for its revenue, such as `"data.value"`. A page view rule with a goal still sends its page view:

A page view rule with a goalId still tracks the page view and adds a goal hit to the same request.

Event

```json
{
  "name": "page view",
  "data": {
    "domain": "www.example.com",
    "title": "walkerOS documentation",
    "referrer": "https://www.walkeros.io/",
    "search": "?foo=bar",
    "hash": "#hash",
    "id": "/docs/"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "pagegroup": "docs"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "f0cc5f6fec3d8eeb",
  "trigger": "load",
  "entity": "page",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "settings": {
    "goalId": 3
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&action_name=walkerOS+documentation&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\",\"?idsite=1&rec=1&apiv=1&idgoal=3&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

## Visitors[​](#visitors "Direct link to Visitors")

The visitor ID goes as `cid`, Matomo's forced visitor ID: 16 hex characters hashed from `user.device`, which the [session source](https://www.walkeros.io/docs/sources/web/session.md#storage-based-detection) sets in storage mode. Matomo recognizes a visitor by this ID alone, also when its force-cookieless option is on, and needs no `trust_visitors_cookies` change. A value that is already 16 lowercase hex characters passes through as it is. Matomo splits a visit after 30 minutes without a hit, at midnight and on a campaign change.

`uid` goes only when you set `userId`, like `"event.user.id"`. With `uid`, Matomo uses a hash of the user ID as the visitor ID instead of `cid`, and a user's first identified hit of a visit may join another visitor's visit by its fingerprint. Set `userId` together with `ip`, `credentials.token` and `userAgent`.

Without `cid`, Matomo recognizes visitors by its fingerprint of IP address and user agent, and on a server those are the collector's unless `ip` and `userAgent` are set, so different visitors merge into one visit. The destination still sends such a hit and writes one ERROR line per minute with code `visitor-merge` when a hit does not carry both the visitor's IP and user agent and has either no visitor ID or a user ID.

## IP, location and device[​](#ip-location-and-device "Direct link to IP, location and device")

The destination sends no IP address, no user agent and no user ID unless you set them. To give Matomo the visitor's location and device, map them from the request and add a token:

```json
"config": {
  "settings": {
    "url": "https://matomo.example.com/",
    "siteId": "1",
    "ip": ["ingest.ip", "event.user.ip"],
    "userAgent": ["ingest.userAgent", "event.user.userAgent"]
  },
  "credentials": { "token": "$secret.MATOMO_TOKEN" }
}
```

To send the user ID as well, add `"userId": "event.user.id"` to the same settings, see [visitors](#visitors). Your server source fills `ingest.ip` and `ingest.userAgent` with its [ingest map](https://www.walkeros.io/docs/sources/server/express.md#ingest-metadata); behind a proxy, see [client IP behind a proxy](https://www.walkeros.io/docs/sources/server/express.md#client-ip-behind-a-proxy). Matomo rejects a visitor IP (`cip`) without a token, so the destination does not start when `ip` is set without `credentials.token`. The token belongs to a Matomo user with at least write access to the site, see Matomo's [tracking API example](https://matomo.org/faq/general/matomo-tracking-api-example-for-developers/), and it goes only into the request body, as `token_auth`. Matomo anonymizes the IP address by its own privacy settings.

With ip, userAgent and userId set and credentials.token, the hit carries cip, ua and uid, and the bulk body carries the token as token\_auth.

Event

```json
{
  "name": "page view",
  "data": {
    "domain": "www.example.com",
    "title": "walkerOS documentation",
    "referrer": "https://www.walkeros.io/",
    "search": "?foo=bar",
    "hash": "#hash",
    "id": "/docs/"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "pagegroup": "docs"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "f0cc5f6fec3d8eeb",
  "trigger": "load",
  "entity": "page",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&action_name=walkerOS+documentation&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&ua=Mozilla%2F5.0+%28Windows+NT+10.0%3B+Win64%3B+x64%29&cip=192.0.2.1&cid=cc8e27118413234d&uid=us3r&pv_id=0a1b2c&cdt=1700000000\"],\"token_auth\":\"TOKEN\"}", {
  "timeout": 10000
})
```

## Time on page[​](#time-on-page "Direct link to Time on page")

Matomo computes time on page from consecutive page views, so the last page of a visit shows 0 s. On Matomo 6, a heartbeat gives that page its time as well. The destination turns a `page hide` event into this heartbeat: an event named `page hide` that closes a page view, with `data.total`, the milliseconds of the whole page view so far, and the `source.url` and `source.trace` of that page view. Without a rule it becomes one hit, `ping=1`, with the page view ID (`pv_id`) and the page view's time in whole seconds (`pv_time`, from `data.total`, left out when it rounds to 0). No walkerOS source sends a `page hide` event yet; until one does, the last page of a visit shows 0 s.

Matomo 6 records the heartbeat as that page view's time on page. It finds the page view by its ID, so a `page hide` that arrives after the next route's page view still lands on its own page. Matomo 5 shows the last page as 0 s and counts the heartbeat as visit duration.

A page hide becomes one ping hit with the page view id and the page view time in seconds (pv\_time): Matomo 5 counts it as visit duration, Matomo 6 as the time of that page view.

Event

```json
{
  "name": "page hide",
  "data": {
    "engagement": 12000,
    "total": 42500
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "lang": "elb"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "3b0649ba9517e0af",
  "trigger": "test",
  "entity": "page",
  "action": "hide",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "signals",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&ping=1&pv_time=43&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

## Several sites from one step[​](#several-sites-from-one-step "Direct link to Several sites from one step")

`siteId` and `url` take a mapping value too, resolved for every event against `{ ingest, event }`. A function over the page's hostname sends each shop to its own Matomo and site ID:

```json
"settings": {
  "url": {
    "fn": "$code:(_, context) => context.event.source.url && ({ 'shop-a.example': 'https://a.matomo.example/', 'shop-b.example': 'https://b.matomo.example/' })[new URL(context.event.source.url).hostname]"
  },
  "siteId": {
    "fn": "$code:(_, context) => context.event.source.url && ({ 'shop-a.example': '1', 'shop-b.example': '2' })[new URL(context.event.source.url).hostname]"
  }
}
```

With url and siteId as fn maps of the page host, a page view of shop A goes to its own Matomo as site 1.

Event

```json
{
  "name": "page view",
  "data": {
    "domain": "www.example.com",
    "title": "walkerOS documentation",
    "referrer": "https://www.walkeros.io/",
    "search": "?foo=bar",
    "hash": "#hash",
    "id": "/docs/"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "pagegroup": "docs"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "f0cc5f6fec3d8eeb",
  "trigger": "load",
  "entity": "page",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://shop-a.example/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Out

```javascript
sendServer("https://a.matomo.example/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&action_name=walkerOS+documentation&url=https%3A%2F%2Fshop-a.example%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

An event from a host the function does not know fails with `missing-input`, naming `siteId` or `url`.

## Events that arrive late[​](#events-that-arrive-late "Direct link to Events that arrive late")

The event time goes as `cdt`. Matomo needs `credentials.token` for an event older than 24 hours and refuses it without one, so the push fails with Matomo's counts, see [what a 2xx means](#what-a-2xx-means). On Matomo 6, a time more than a day ahead is refused too. The event time is the device's clock, so without a token Matomo also refuses a fresh event from a device whose clock is more than a day behind (or, on Matomo 6, more than a day ahead); the push fails the same way. Set `timestamp: false` to let Matomo use the time it receives the request instead.

## Ecommerce[​](#ecommerce "Direct link to Ecommerce")

Orders and cart updates map to `trackEcommerceOrder` and `trackEcommerceCartUpdate`. The rule setting `items` resolves to the products, each with `sku` and optional `name`, `category` (a string or up to 5), `price` and `quantity`, and is sent as `ec_items`. The order and cart view examples above show the mapping. An order ID Matomo already has for the site is refused, so a resent order fails.

### Product views[​](#product-views "Direct link to Product views")

Matomo records a product view as the product page's one page view carrying the product, which gives each product its conversion rate, see [Matomo's ecommerce FAQ](https://matomo.org/faq/reports/advanced-manually-tracking-ecommerce-actions-in-matomo/). Map `product view` to `trackPageView` with the rule setting `ecommerceView`: its product fields go as `_pks`, `_pkn`, `_pkc` and `_pkp` on that page view.

A product view becomes the product page's page view with the product fields, as Matomo records it; the page's plain page view is skipped (pageViewOnProductPage).

Event

```json
{
  "name": "product view",
  "data": {
    "id": "ers",
    "name": "Everyday Ruck Snack",
    "category": "Backpacks",
    "color": "black",
    "size": "l",
    "price": 420,
    "currency": "EUR"
  },
  "context": {
    "shopping": [
      "detail",
      0
    ]
  },
  "globals": {
    "pagegroup": "shop"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [],
  "consent": {
    "functional": true
  },
  "id": "db22fb16c70f663d",
  "trigger": "load",
  "entity": "product",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "name": "trackPageView",
  "data": {
    "set": [
      "data.name"
    ]
  },
  "settings": {
    "ecommerceView": {
      "map": {
        "sku": "data.id",
        "name": "data.name",
        "category": "data.category",
        "price": "data.price"
      }
    }
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&action_name=Everyday+Ruck+Snack&_pks=ers&_pkn=Everyday+Ruck+Snack&_pkc=Backpacks&_pkp=420&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

The product page's plain `page view` must then send no second page view. For data-layer setups, Matomo's FAQ advises to stop it on product pages. A rule with a condition on the event does that:

On a product page the plain page view is skipped, so the product view sends the page's one page view, as Matomo's ecommerce FAQ advises for data-layer setups.

Event

```json
{
  "name": "page view",
  "data": {
    "domain": "www.example.com",
    "title": "walkerOS documentation",
    "referrer": "https://www.walkeros.io/",
    "search": "?foo=bar",
    "hash": "#hash",
    "id": "/docs/"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "pagetype": "product"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "f0cc5f6fec3d8eeb",
  "trigger": "load",
  "entity": "page",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "condition": {
    "$code": "(e,t)=>\"product\"===t.event.globals?.pagetype"
  },
  "ignore": true
}
```

Out

```javascript
// no output
```

In a `flow.json`, write the condition with `$code:`; in the walkerOS app, write the same rule into the destination's Mapping code, which holds what `mapping` holds here:

```json
"mapping": {
  "page": {
    "view": {
      "condition": "$code:(event) => event.globals.pagetype === 'product'",
      "ignore": true
    }
  }
}
```

The condition reads the event, not how the value got there. Give a product page's events `globals.pagetype: 'product'` in the way that fits your site:

* **Tagging:** `<body data-elbglobals="pagetype:product">` on the product page, as in the [walker.js quickstart](https://www.walkeros.io/docs/getting-started/quickstart/walkerjs.md#tag-your-page), see [globals](https://www.walkeros.io/docs/sources/web/browser/tagging/html-attributes.md#globals).
* **Code:** `elb('walker globals', { pagetype: 'product' })` on the product page before its page view, see the [globals command](https://www.walkeros.io/docs/collector/commands.md#globals).
* **The event as sent:** an event with `"globals": { "pagetype": "product" }`, for example one sent with [`walkeros push`](https://www.walkeros.io/docs/apps/cli.md#push-command) or in a simulation.

Set the value where the product's `product view` is set. Otherwise:

* A product page whose events lack the value counts two page views, the plain one and the product view.
* A page whose events carry the value but that sends no `product view` sends no page view at all, and nothing reports it.

## Custom dimensions[​](#custom-dimensions "Direct link to Custom dimensions")

Custom dimensions are keyed by bare dimension id, like `{ "1": "data.size" }`, and each value is a mapping value resolved for every event. `settings.customDimensions` applies to every hit, and a rule's `settings.customDimensions` wins per key:

Destination and rule custom dimensions, keyed by bare id, are sent as dimension parameters on the hit.

Event

```json
{
  "name": "page view",
  "data": {
    "domain": "www.example.com",
    "title": "walkerOS documentation",
    "referrer": "https://www.walkeros.io/",
    "search": "?foo=bar",
    "hash": "#hash",
    "id": "/docs/"
  },
  "context": {
    "dev": [
      "test",
      1
    ]
  },
  "globals": {
    "pagegroup": "docs"
  },
  "custom": {
    "completely": "random"
  },
  "user": {
    "id": "us3r",
    "device": "c00k13",
    "session": "s3ss10n",
    "ip": "192.0.2.1",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
    "screenSize": "1920x1080"
  },
  "nested": [
    {
      "entity": "child",
      "data": {
        "is": "subordinated"
      }
    }
  ],
  "consent": {
    "functional": true
  },
  "id": "f0cc5f6fec3d8eeb",
  "trigger": "load",
  "entity": "page",
  "action": "view",
  "timestamp": 1700000000000,
  "timing": 3.14,
  "source": {
    "count": 1,
    "trace": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
    "type": "browser",
    "platform": "web",
    "url": "https://www.example.com/",
    "referrer": "https://www.walkeros.io/"
  }
}
```

Mapping

```json
{
  "settings": {
    "customDimensions": {
      "2": "data.domain"
    }
  }
}
```

Out

```javascript
sendServer("https://matomo.example.com/matomo.php", "{\"requests\":[\"?idsite=1&rec=1&apiv=1&action_name=walkerOS+documentation&dimension1=docs&dimension2=www.example.com&url=https%3A%2F%2Fwww.example.com%2F&urlref=https%3A%2F%2Fwww.walkeros.io%2F&res=1920x1080&cid=cc8e27118413234d&pv_id=0a1b2c&cdt=1700000000\"]}", {
  "timeout": 10000
})
```

## What a 2xx means[​](#what-a-2xx-means "Direct link to What a 2xx means")

Matomo answers a bulk request with how many requests it tracked and how many it found invalid. When it tracked fewer than the destination sent, for example for an unknown `siteId`, an invalid parameter, an order ID it already has or an old event without a token, the push fails with `transport` and the counts, and the event goes to the dead-letter queue. A non-2xx answer fails with its status.

With Matomo's QueuedTracking plugin, Matomo queues the request and answers before it tracks it, without counts. The push then counts as delivered, and a request Matomo refuses later cannot be seen. The destination writes one WARN line per minute with code `unconfirmed`, which the default log level (`ERROR`) does not show.

Matomo counts a visit it excludes by its own settings (excluded IPs, bots, opt-outs) or by Tracking Spam Prevention (see [before you start on Matomo 6](#before-you-start-on-matomo-6)) as tracked. When visits are missing although the pushes are delivered, check those settings.

## Consent[​](#consent "Direct link to Consent")

Gate the destination with `config.consent`, so only events with that consent reach Matomo. Matomo itself receives no consent signal over this API.

```json
"config": {
  "consent": { "analytics": true }
}
```

See [consent management](https://www.walkeros.io/docs/guides/consent.md) for how events wait for consent.

## Coming from the API destination[​](#coming-from-the-api-destination "Direct link to Coming from the API destination")

If you send to Matomo with the [API destination](https://www.walkeros.io/docs/destinations/api/server.md) and a hand-built Tracking API mapping, its parameters map to this destination's settings one to one: `cip` to `ip`, `ua` to `userAgent`, `lang` to `language` and `res` to `screenSize`. Its `_id` becomes `cid`, from the `visitorId` setting, and its `token_auth` moves to `credentials.token`.

## Related[​](#related "Direct link to Related")

* [Matomo web destination](https://www.walkeros.io/docs/destinations/web/matomo.md)
* [Express source](https://www.walkeros.io/docs/sources/server/express.md)
* [Session source](https://www.walkeros.io/docs/sources/web/session.md)
* [Consent management](https://www.walkeros.io/docs/guides/consent.md)
