semust logo

Semust Metrik

Configuration

Every Metrik script option, the values it accepts and its default.

Metrik is configured in one of two ways: data-* attributes on the script tag, or a window.semustMetrikConfig object defined before the script loads. Both control the same settings; if semustMetrikConfig is present, the data-* attributes are ignored.

Product page: Semust Metrik.

Settings

Settingdata-* attributesemustMetrikConfigDefault
Access keydata-tokentoken— (required)
Cookieless modedata-cookieless="1"cookieless: trueOff
Revenue trackingdata-revenue="true"revenue: trueOff
Cross-domain trackingdata-allowed-hostnamesallowedHostnamesOff

Values must match exactly

data-cookieless only turns on for the value "1""true" and "yes" do nothing. data-revenue only turns on for "true". With semustMetrikConfig, both must be real booleans: true, not "true".

Examples

<script src="https://unpkg.com/semust-js@latest/dist/semust-js.min.js"
        data-token="mk_your-key-here"
        data-cookieless="1"
        data-revenue="true"
        data-allowed-hostnames="shop.example.com,blog.example.com"></script>

Each setting explained

token

Your project's access key. It starts with mk_ and lives under Settings → Access Key. Without it, nothing is recorded.

cookieless

Turns off cookies and persistent browser storage for visitor identification. For the details and the privacy trade-offs, see Privacy.

revenue

Enables revenue tracking. While it is off, semustMetrik.trackPayment() calls are silently ignored and checkout auto-detection does not run. See Revenue tracking.

allowedHostnames

Carries a visitor's identity across domains. Metrik appends identity parameters to links pointing at the hostnames you list, so someone moving from example.com to shop.example.com counts as one visitor rather than two.

A comma-separated string, not an array

This setting expects a string: "a.com,b.com". Passing an array (["a.com"]) throws while the script starts up, and nothing is measured at all.

This is not a security setting

allowedHostnames only controls cross-domain identity. It does not restrict which sites may send data.

Changing your access key

Settings → Rotate Key issues a new key and invalidates the old one immediately. Measurement stops until you update data-token on your site.

Last updated: 2026-08-26