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
| Setting | data-* attribute | semustMetrikConfig | Default |
|---|---|---|---|
| Access key | data-token | token | — (required) |
| Cookieless mode | data-cookieless="1" | cookieless: true | Off |
| Revenue tracking | data-revenue="true" | revenue: true | Off |
| Cross-domain tracking | data-allowed-hostnames | allowedHostnames | Off |
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><script>
window.semustMetrikConfig = {
"token": "mk_your-key-here",
"cookieless": true,
"revenue": true,
"allowedHostnames": "shop.example.com,blog.example.com"
};
</script>
<script src="https://unpkg.com/semust-js@latest/dist/semust-js.min.js"></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.
