# Goals

> Count signups, purchases, bookings or any page or click you care about.

A goal is something you want visitors to do: sign up, buy, book a call or send a form. Tell Okidoki what reaching it looks like, and it counts how often it happened, as a share of your visitors.

## Three kinds of goals

| Kind | Reached when | Example |
| --- | --- | --- |
| **A page** | Someone opens the page | `/thanks`, or `/order/done/*` for every page below it |
| **A click** | An event happens | `form`, `download`, `email`, `phone`, `outbound`, or your own event like `Signup` |
| **Engagement** | Someone reads, stays or goes on | Read to the end, stayed over a minute, saw more than one page |

Each page view or event counts once. End a page with `*` to match every page that starts with it.

## Engagement goals

Every site can track these, with no change to the site. When a page is left, the script already reports how far it was scrolled, how long it was on screen and whether the visitor went on to another page. Okidoki counts engagement goals from that, so nothing new is sent or stored, and one page is still never linked to the next.

| Goal | Counts |
| --- | --- |
| **Read to the end** | A page scrolled to at least 90% of its height and on screen for at least 15 seconds. On a page short enough to fit the screen, that means they stayed 15 seconds. |
| **Stayed over a minute** | A page on screen for at least a minute in one go. You can choose another time, from 10 seconds to 30 minutes. |
| **Saw more than one page** | A visit that went on to another page after the first one. Counted once per visit. |

Read and time can be limited to one page or a section, like `/blog/*`. They count page views, so their share is of page views, not of visitors. Saw more than one page is shared over visitors, and it can be split by campaign, since it belongs to the page the visit started on.

The numbers are a little low rather than too high. Time and scroll are taken until the visitor first leaves the tab, so someone who switches apps halfway and comes back to finish is not counted. Okidoki does not count how many pages a visit saw in total, or whether someone came back to a page, because that would mean linking page views together. Pages per visit on the overview gives the average instead. Visitors who come back on another day are never counted.

## The Goals page

**Goals** in the menu answers **Do they do what I want?** Once goals are reached, the answer comes first: how each goal went, and on Plus [what gave the result](https://docs.okidoki.sh/funnels#what-gave-the-result). Then come your measurement plan, monthly targets, the [event lexicon](https://docs.okidoki.sh/views#the-event-lexicon), [funnels](https://docs.okidoki.sh/funnels) and [A/B tests](https://docs.okidoki.sh/ab-tests).

## Your measurement plan

You do not need to know what a goal is to get them. Once your site has its first visit, Okidoki reads a handful of its pages and suggests the goals worth counting, like **Sent the contact form**, **Went to book a time** or **Looked at prices**, grouped into **Most important** and **Good to track**. If you have not picked any goals yet, it starts tracking the most important ones by itself. Change or remove them like any other goal.

Okidoki also says what kind of site it is, like an online shop or something to read. A site can be more than one kind: a bakery that sells cakes and has recipes to read is both. Change them under **Industry and type** in the site's reading, and the most important goals follow every kind you pick. You can pick up to three, the main kind first. An agent sets them with the MCP tool `set_site_kind` or `PATCH /api/v1/sites/:site/plan/kind` with `{"kinds": ["shop", "content"]}`.

The first read is free. **Read my site again** later uses one question to [Okidoki AI](https://docs.okidoki.sh/ask). Okidoki follows your `robots.txt` and keeps nothing personal. Some goals need a small change on your site, like a name on a button; the plan says so and gives you the request to paste into your site builder.

## Add a goal yourself

Under **Something else**, give the goal a name and a page or an event, and press **Track it**. Okidoki also suggests goals from what visitors already did on your site in the last 30 days, like **Reached /thanks**. Click one to track it.

A site can have 10 goals, so the report stays readable.

## Targets for the month

Give a goal a target, like *200 purchases in November*. Okidoki shows every day how far the month has come, where an even month would be today, and whether you are ahead, on track or behind, with what a day it takes to get there. The pace spreads the target evenly over the month in your site's time zone; within 10% counts as on track. Free can set a target on one goal per site, Plus on every goal.

## Read the goals report

Each goal shows how many times it was reached in the period, the share of visitors that is, and the change from the period before. Filters on place and technology work too, so you can see how many phone visitors signed up. Filters on where visits came from do not, because a goal is never linked to the visit it was part of. To see which channels lead to a goal anyway, as an estimate, see [What gave the result?](https://docs.okidoki.sh/funnels#what-gave-the-result) (Plus).

## Count a button as a goal

Buttons are not counted by themselves. Add an attribute to the button, then add a goal for the event:

```html
<button data-okidoki-event="Signup">Create account</button>
```

Then add a goal with the event `Signup`. See [Custom events](https://docs.okidoki.sh/custom-events).

## Goals from the API

```bash
# Ideas from what visitors did
curl -H "Authorization: Bearer oks_..." https://okidoki.sh/api/v1/sites/mysite.com/goal-ideas

# A page goal
curl -X POST https://okidoki.sh/api/v1/sites/mysite.com/goals \
  -H "Authorization: Bearer oks_..." -H "Content-Type: application/json" \
  -d '{"name":"Reached /thanks","page":"/thanks"}'

# A click goal
curl -X POST https://okidoki.sh/api/v1/sites/mysite.com/goals \
  -H "Authorization: Bearer oks_..." -H "Content-Type: application/json" \
  -d '{"name":"Sent a form","event":"form"}'

# An engagement goal: read, time (with seconds) or pages
curl -X POST https://okidoki.sh/api/v1/sites/mysite.com/goals \
  -H "Authorization: Bearer oks_..." -H "Content-Type: application/json" \
  -d '{"name":"Read an article to the end","engaged":"read","target":"/blog/*"}'
```

A goal on an event can also have a `target`, like a site name for `outbound` or a file path for `download`, to count only those. See the [API reference](https://docs.okidoki.sh/api/reference#goals).

## What goals do not do

- They do not follow people, so they cannot tell you who reached a goal. What came before is counted page by page, see [Funnels and paths](https://docs.okidoki.sh/funnels).
- They do not count revenue.

