Skip to content

Commit 3c9c35a

Browse files
committed
filters, dimensions, include, warning text
1 parent afdab0c commit 3c9c35a

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

docs/stats-api-v2.md

+44-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Stats API v2 reference
3+
toc_max_heading_level: 4
34
---
45

56
import ApiV2Example from '../src/js/apiv2-example.js';
@@ -8,7 +9,7 @@ import {Required, Optional} from '../src/js/api-helpers.js';
89

910
:::warning
1011

11-
Please be advised that this feature is currently in its beta stage. Some functionality might change in the upcoming releases.
12+
Please be advised that this feature is currently in beta. Some functionality might be broken or change in the coming months.
1213

1314
:::
1415

@@ -20,7 +21,11 @@ The Plausible Stats API offers a way to retrieve your stats programmatically. It
2021

2122
You can obtain an API key for your account by going to your user settings page [plausible.io/settings](https://plausible.io/settings).
2223

23-
After creating a token, you can authenticate your request by sending the token in the Authorization header of your request. For example, in the following request, replace YOUR-TOKEN with a reference to your token and site_id value with your domain.
24+
After creating a token, you can authenticate your request by sending the token in the Authorization header of your request.
25+
26+
### Example curl request
27+
28+
In the following request, replace YOUR-TOKEN with a reference to your token and site_id value with your domain.
2429

2530
```bash
2631
curl \
@@ -77,7 +82,7 @@ Valid metrics are:
7782
| `conversion_rate` | The percentage of visitors who completed the goal. Requires: dimension list passed, an event:goal filter or event:goal dimension |
7883
| `group_conversion_rate` | The percentage of visitors who completed the goal with the same dimension. Requires: dimension list passed, an event:goal filter or event:goal dimension |
7984

80-
### dimensions <Optional />
85+
### dimensions <Optional /> {#dimensions}
8186

8287
Default: `[]`
8388

@@ -132,11 +137,11 @@ Mixing session metrics `bounce_rate`, `views_per_visit` and `visit_duration` wit
132137

133138
Default: `[]`
134139

135-
Filters allow limiting the data analyzed in a query. Each filter takes the form of `[operator, dimension, list_of_values]`. See [example](#filtering-basic).
140+
Filters allow limiting the data analyzed in a query. Each filter takes the form of `[operator, dimension, clauses]`. See [example](#filtering-basic).
136141

137-
#### operators
142+
**operators**
138143

139-
The following operators are supported
144+
The following operators are currently supported:
140145

141146
| Operator | Example | Explanation |
142147
| -- | -- | -- |
@@ -147,8 +152,41 @@ The following operators are supported
147152

148153
`matches` and `does_not_match` uses XXX system for matching. TODO
149154

155+
**dimension**
156+
157+
[All dimensions listed above](#dimensions) are valid except for time-related ones.
158+
159+
Note that only `is` operator is valid for `event:goal` dimension.
160+
161+
**clauses**
162+
163+
List of values to match against. A data point matches filter if _any_ of the clauses matches.
164+
150165
### include <Optional />
151166

167+
Default: `{}`
168+
169+
Additional options for the query as to what data to include.
170+
171+
#### include.imports
172+
173+
Default: `false`
174+
175+
If true, tries to include imported data in the result.
176+
177+
Not all queries support including imported data.
178+
179+
TODO: Examples, limitations
180+
181+
#### include.time_labels
182+
183+
Default: `false`
184+
185+
Requires a `time` dimension being set. If true, sets meta.time_labels in response containing all
186+
time labels valid for `date_range`.
187+
188+
TODO: Link to an example
189+
152190
## Examples
153191

154192
:::tip

0 commit comments

Comments
 (0)