Setting up goals

Last updated 2026-04-28

Goals turn raw page views into meaningful conversions. Define a goal once, and HitCounters tracks every visitor who completes it — with the conversion rate and (optional) value attribution.

Two types of goals

  • URL goals — fire automatically when a visitor reaches a page matching your URL pattern. Best for: thank-you pages, confirmation pages, specific articles. No code needed.
  • Event goals — fire when your site calls hcEvent('name') from JavaScript. Best for: button clicks, form submits, video plays, custom interactions.

Creating a URL goal

  1. Go to /dashboard/goals.php and click New Goal.
  2. Give it a name (e.g. "Newsletter signup", "Purchase complete").
  3. Type: URL match.
  4. Match mode: pick one
    • Exact — full URL must match: https://example.com/thank-you
    • Contains — URL contains this string: /thank-you
    • Starts with — URL starts with this prefix: https://example.com/orders/
    • Regex — full regex match for advanced patterns
  5. (Optional) Default value — if every conversion has a known dollar value, enter it here.
  6. Save.

Creating an event goal

  1. Same flow, pick Custom event as the type.
  2. Enter the event name (e.g. signup, purchase, video_play) — case-insensitive.
  3. Save.

Then add code on your site:

// Anywhere on your site:
hcEvent('signup');

// With a value (e.g. purchase amount):
hcEvent('purchase', 49.99);

Common patterns:

// On a button click
document.querySelector('#signup-btn').addEventListener('click', () => hcEvent('signup'));

// On form submit
document.querySelector('#contact-form').addEventListener('submit', () => hcEvent('contact_form'));

// On a video play
document.querySelector('video').addEventListener('play', () => hcEvent('video_play'));

Deduplication

A given session counts at most once per goal. Refreshing the thank-you page won't inflate your conversion count. For events without a session match (rare; usually means the session is still being processed), we dedupe by visitor + goal + day.

Where conversions show up

  • Goals page — live count of 7-day and 30-day conversions per goal, with conversion rate.
  • Reports → Conversions tab — total conversions, conversion rate, total value, and per-goal breakdown.

Pausing or deleting goals

From the Goals page, the play/pause button toggles whether new conversions get recorded for that goal. Deleting removes the goal but keeps past conversions for historical reporting.

Related articles

Still need help? Send us a message — we reply within 24 hours.