Skip to content
StaticHero

Analytics

Track clicks, signups and conversions with custom events

Use data attributes or a one-line JavaScript call to track custom events, then turn them into goals with conversion rates.

The StaticHero Team · · 1 min read

Pageviews tell you what people read. Events tell you what they do. StaticHero tracks some events automatically and lets you add your own in seconds. (Custom events and goals are available on all paid plans.)

Tracked automatically

  • Outbound link clicks — any link to another domain.
  • File downloads — PDFs, ZIPs, documents, media.
  • Form submissions — named after the form.

Custom events with HTML

Add data-sh-event to any clickable element:

<a href="/pricing" data-sh-event="Pricing CTA">See pricing</a>
<button data-sh-event="Play demo video">▶ Watch</button>

Add properties with data-sh-prop-*:

<button data-sh-event="Add to cart" data-sh-prop-product="Moss bowl" data-sh-prop-size="large">
  Add to cart
</button>

Custom events with JavaScript

The tracker exposes a global statichero() function:

statichero("Signup", { plan: "pro", source: "hero" });

If you might call it before the script loads, queue calls safely:

window.statichero = window.statichero || function () {
  (window.statichero.q = window.statichero.q || []).push(arguments);
};

Turn events into goals

In the Analytics tab, scroll to Goals and add:

  • an event goal such as Signup, or
  • a page goal such as /thank-you (wildcards work: /blog/*).

Each goal shows unique converting visitors and a conversion rate, and responds to the dashboard filters — so you can see, for example, the signup rate of visitors from a specific campaign.

Exclude yourself

To stop counting your own visits, open your site, run this in the browser console once:

localStorage.statichero_ignore = "true";

Your site could be live in the next minute.

One site free, forever. No credit card, no setup, no servers.