Skip to content
metryo

06Click tracking · Paid plans

Click tracking: measure clicks without writing code

On any paid plan the script also records clicks on its own. Mark an element with data-metryo-event and it is tracked by name; outbound links and file downloads are detected with no markup at all.

Click tracking is available from the Starter plan upwards. On the Free plan these events are discarded and never count towards your monthly allowance — metryo.event() keeps working on every plan.

Naming a click

index.html
<!-- Name a click yourself: no JavaScript needed -->
<button data-metryo-event="Add card">
  Add card
</button>

<!-- Attach properties with data-metryo-prop-*
     Use lowercase, hyphen-separated names. HTML lowercases
     every attribute, so data-metryo-prop-planName would
     arrive as "planname" — write plan-name instead. -->
<button
  data-metryo-event="Signup started"
  data-metryo-prop-plan="growth"
  data-metryo-prop-signup-position="hero"
>
  Start for free
</button>

<!-- Opt an element out entirely -->
<a href="https://example.com" data-metryo-ignore>Ignored</a>

Detected automatically

  • Outbound link — any link to a different hostname, with the destination domain, its path and the link text as properties. The query string is never sent: it routinely carries session tokens and email addresses.
  • File download — links ending in a document, archive, installer or media extension, with the file name attached.
  • In-page anchors and mailto: or tel: links are skipped, so they never consume your allowance.

Turning detection off

head.html
<!-- Keep marked elements only: no outbound or download
     tracking -->
<script
  defer
  data-site="site_xxxxx"
  data-auto-clicks="off"
  src="https://cdn.metryo.io/m.js">
</script>