Skip to content
metryo

13Script options

Script options: everything the tag accepts

The script needs only data-site. The rest are attributes for the cases that need them, and one localStorage key for keeping your own visits out of your numbers.

head.html
<script
  defer
  data-site="site_xxxxx"

  data-hash="on"            <!-- count #/route changes as pageviews -->
  data-auto-clicks="off"    <!-- keep marked elements only (paid plans) -->
  data-api="https://cdn.metryo.io/api/collect"  <!-- only if you self-host m.js -->

  src="https://cdn.metryo.io/m.js">
</script>

<!-- Exclude your own browser from every site you own -->
<script>localStorage.setItem("metryo_ignore", "true")</script>
  • data-hash="on" — for apps that route with the URL fragment (/#/settings). Each fragment change counts as a pageview and the fragment is part of the page path. Off by default, because on ordinary sites a fragment is a heading.
  • data-auto-clicks="off" — stops outbound-link and download detection. Elements you marked with data-metryo-event are still tracked.
  • data-api — where beacons are sent. Only needed when the script is served from somewhere other than Metryo; by default it is derived from the script's own URL.
  • metryo_ignore — set this localStorage key to "true" in your own browser and the script sends nothing from it, on every website you track. Remove the key to start again.