# Goals and custom events

Source: https://analytics.5h3ll.site/docs/goals

Count signups, clicks and anything else, from HTML, JavaScript or your server.

A goal is a named action. You can see how many happened, which pages and sources led to them and how they convert.

## Track a click with HTML

```
<button data-ml-goal="signup_click">Get started</button>
```

Add `data-ml-goal-location` or other `data-ml-goal-*` attributes to attach properties.

## Track from JavaScript

```
window.minilytics('goal', 'signup', { plan: 'pro' });
```

## Track from your server

Server-side goals are useful for things the browser cannot see. Send the visitor ID from the `ml_vid` cookie with your API key.

```
curl -X POST https://analytics.5h3ll.site/api/v1/goals \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"visitor_id":"VISITOR_ID","name":"signup"}'
```

Previous

Installing the script

Next

Identify visitors

Something missing or wrong? [Open a support ticket](https://analytics.5h3ll.site/support).
