Skip to content

Track clicks from HTML

Record a custom event from a button, link, or form with data attributes.

Add HTML attributes to track an interaction without writing JavaScript.

  1. Add data-supermetry-event to the clickable element.

    <button
    type="button"
    data-supermetry-event="Signup"
    data-supermetry-prop-plan="pro"
    data-supermetry-prop-location="header"
    >
    Start free
    </button>
  2. Deploy the change and click the element once.

  3. Open Events and select Signup.

The full generated tracker also reads these attributes from submitted forms. Property names are the text after data-supermetry-prop-; they are stored only when identified collection is enabled.

What you should see: Signup appears under Events, with the two properties when identified collection is enabled.