Markus Michalski FAQ

Matomo Analytics: Shop API / Headless

Matomo Analytics for Sylius - Shop API endpoint for headless storefronts: fetch channel settings, response format with all fields, effective e-commerce flags and error cases

Deutsche Version

Back to overview

Matomo Analytics: Shop API / Headless

This documentation always describes the latest published version.

A headless storefront does not see the Twig script. So that it can build its own Matomo tracker, the Shop API provides the settings of the channel. It is read-only, nothing can be written through it.

Endpoint

Method Path Description
GET /api/v2/shop/matomo-settings Settings of the channel the request resolves to

The channel is determined by Sylius as for any Shop API request, and each channel only receives its own settings.

curl -s https://shop.example.com/api/v2/shop/matomo-settings -H "Accept: application/json"

Response

{
    "channelCode": "DE",
    "matomoUrl": "https://analytics.example.com",
    "siteId": 7,
    "cookielessTracking": true,
    "respectDoNotTrack": true,
    "useKlaroConsent": true,
    "klaroServiceName": "matomo",
    "heartbeatEnabled": true,
    "heartbeatInterval": 15,
    "trackOutboundLinks": true,
    "trackProductViews": true,
    "trackOrders": true
}
Field Type Description
channelCode string Code of the channel
matomoUrl string Matomo URL without trailing slashes
siteId integer Site ID
cookielessTracking boolean Whether tracking is cookieless
respectDoNotTrack boolean Whether Do-Not-Track is honoured
useKlaroConsent boolean Whether tracking is behind Klaro consent
klaroServiceName string Technical name of the Klaro service
heartbeatEnabled boolean Whether the heartbeat timer runs
heartbeatInterval integer Heartbeat interval in seconds
trackOutboundLinks boolean Whether outbound links and downloads are tracked
trackProductViews boolean Whether product views are tracked
trackOrders boolean Whether orders are tracked

trackProductViews and trackOrders are already the effective values, combined with the e-commerce main switch. Your client does not have to combine two settings itself.

useKlaroConsent and klaroServiceName tell the headless client which gating convention to adopt if it also runs Klaro. In headless operation the plugin does not implement the gating itself, that is up to your client.

Errors

Status When
404 The channel cannot be resolved
404 The channel has no entry, is switched off or is incomplete (no valid HTTPS URL or no site ID)

For the API, a channel that tracks nothing is therefore the same as a missing entry: a 404 without settings. The conditions are the same as in the storefront, see Configuration.