You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/stats-api-v2.md
+44-6
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
---
2
2
title: Stats API v2 reference
3
+
toc_max_heading_level: 4
3
4
---
4
5
5
6
import ApiV2Example from '../src/js/apiv2-example.js';
@@ -8,7 +9,7 @@ import {Required, Optional} from '../src/js/api-helpers.js';
8
9
9
10
:::warning
10
11
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.
12
13
13
14
:::
14
15
@@ -20,7 +21,11 @@ The Plausible Stats API offers a way to retrieve your stats programmatically. It
20
21
21
22
You can obtain an API key for your account by going to your user settings page [plausible.io/settings](https://plausible.io/settings).
22
23
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.
24
29
25
30
```bash
26
31
curl \
@@ -77,7 +82,7 @@ Valid metrics are:
77
82
|`conversion_rate`| The percentage of visitors who completed the goal. Requires: dimension list passed, an event:goal filter or event:goal dimension |
78
83
|`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 |
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).
136
141
137
-
#### operators
142
+
**operators**
138
143
139
-
The following operators are supported
144
+
The following operators are currently supported:
140
145
141
146
| Operator | Example | Explanation |
142
147
| -- | -- | -- |
@@ -147,8 +152,41 @@ The following operators are supported
147
152
148
153
`matches` and `does_not_match` uses XXX system for matching. TODO
149
154
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
+
150
165
### include <Optional />
151
166
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
0 commit comments