Tracker configuration

The Umami tracker provides several properties that allow you to configure its behavior.

data-host-url

v2.0.0

By default, Umami will send data to wherever the script is located. You can override this to send data to another location.

<script
  defer
  src="http://mywebsite.com/umami.js"
  data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
  data-host-url="http://stats.mywebsite.com"
></script>

data-auto-track

v2.0.0

By default, Umami tracks all pageviews and events for you automatically. You can disable this behavior and track events yourself using the tracker functions.

<script
  defer
  src="http://mywebsite.com/umami.js"
  data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
  data-auto-track="false"
></script>

data-domains

v2.0.0

If you want the tracker to only run on specific domains, you can add them to your tracker script. This is a comma delimited list of domain names. Each value matches against window.location.hostname, so you should double check if your website uses www or not.
Helps if you are working in a staging/development environment.

<script
  defer
  src="http://mywebsite.com/umami.js"
  data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
  data-domains="mywebsite.com,www.mywebsite.com"
></script>

data-tag

v2.11.0

Group events under a named tag for filtering and A/B testing. See Tags for more details.

<script
  defer
  src="http://mywebsite.com/umami.js"
  data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
  data-tag="homepage-layout-a"
></script>

data-performance

v3.1.0

Enable automatic collection of Core Web Vitals from your visitors' browsers. See Performance for more details.

<script
  defer
  src="http://mywebsite.com/umami.js"
  data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
  data-performance="true"
></script>

v2.11.0

If you don't want to collect search parameters from the URL.

<script
  defer
  src="http://mywebsite.com/umami.js"
  data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
  data-exclude-search="true"
></script>

data-exclude-hash

v2.16.0

If you don't want to collect the hash value from the URL.

<script
  defer
  src="http://mywebsite.com/umami.js"
  data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
  data-exclude-hash="true"
></script>

data-do-not-track

v2.17.0

Respect user's Do Not Track browser setting.

<script
  defer
  src="http://mywebsite.com/umami.js"
  data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
  data-do-not-track="true"
></script>

data-before-send

v2.18.0

Allows you to specify a function that will be called before data is sent. You can then inspect and modify the payload or cancel the send entirely. The function will take two parameters, type and payload. To continue with sending, you return a payload object. To cancel the send, return a false-y value.

function beforeSendHandler(type, payload) {
  if (checkPayload(payload)) {
    return payload;
  }
  return false;
}
<script
  defer
  src="http://mywebsite.com/umami.js"
  data-website-id="94db1cb1-74f4-4a40-ad6c-962362670409"
  data-before-send="beforeSendHandler"
></script>