Documentation · API reference
POST
/api/v1/sites/{site}/picksCount a click on what a selector matches as an event
This page as Markdown, or in an AI chatMore ways to read this page
Count a click on what a selector matches as an event. The site's script carries it: nothing on the site's pages changes.
# Count a click on what a selector matches as an event
> tidekeeper's API reference: https://tidekeeper.eu/docs/api/post-sites-site-picks
`POST /api/v1/sites/{site}/picks`
Count a click on what a selector matches as an event. The site's script carries it: nothing on the site's pages changes.
## Parameters
- `site` (in path, needed): A site's id or name
## What to send
`PickCreate`: Pick an element: count a click on what a selector matches as an event.
- `attr` (string or null): The attribute of the element the property's value is read from.
- `event` (string): The event a click is counted as. One that exists already is added to.
- `goal` (string or null): Make a goal of the event as well, with this name.
- `path` (string or null): The one path it counts on. Left out: every page where it matches.
- `prop` (string or null)
- `selector` (string)
- `value` (string or null): Or the value it always has.
## The answer
201, `PickedView`: An element picked on a stored copy of a page (the Picker board): a click on what its selector matches is an event.
- `attr` (string or null)
- `by` (string, needed)
- `event` (string, needed)
- `id` (string, needed)
- `made` (integer, needed)
- `path` (string or null): The one path it counts on. None: every page where it matches.
- `prop` (string or null): A property sent with it, and where its value comes from: one of the element's attributes, or a fixed text.
- `says` (string, needed): What it sends, in a line.
- `selector` (string, needed)
- `value` (string or null)
## Asking
```sh
curl -X POST https://tidekeeper.eu/api/v1/sites/example.org/picks \
-H "Authorization: Bearer $TIDEKEEPER_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
```
Parameters
- sitein the address
- neededA site's id or name
What to send
PickCreate Pick an element: count a click on what a selector matches as an event.
- attr
- string or nullThe attribute of the element the property's value is read from.
- event
- stringThe event a click is counted as. One that exists already is added to.
- goal
- string or nullMake a goal of the event as well, with this name.
- path
- string or nullThe one path it counts on. Left out: every page where it matches.
- prop
- string or null
- selector
- string
- value
- string or nullOr the value it always has.
The answer
Status 201
PickedView An element picked on a stored copy of a page (the Picker board): a click on what its selector matches is an event.
- attr
- string or null
- by
- stringneeded
- event
- stringneeded
- id
- stringneeded
- made
- integerneeded
- path
- string or nullThe one path it counts on. None: every page where it matches.
- prop
- string or nullA property sent with it, and where its value comes from: one of the element's attributes, or a fixed text.
- says
- stringneededWhat it sends, in a line.
- selector
- stringneeded
- value
- string or null
Asking
curl -X POST https://tidekeeper.eu/api/v1/sites/example.org/picks \ -H "Authorization: Bearer $TIDEKEEPER_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'
const answer = await fetch("https://tidekeeper.eu/api/v1/sites/example.org/picks", { method: "POST", headers: { Authorization: `Bearer ${process.env.TIDEKEEPER_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({}), }).then((r) => r.json());