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: packages/micro-analytics-cli/readme.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,12 +44,28 @@ To track a view of `x`, simply send a request to `/x`. This is how you'd track p
44
44
</script>
45
45
```
46
46
47
-
If you send a `GET` request, the request will increment the views and return the total views for the id. (in this case "x") If you send a `POST` request, the views will increment but you don't get the total views back.
47
+
If you send a `GET`or `POST`request, the request will increment the views and return the total views for the id (in this case "x").
48
48
49
49
#### `GET` the views without incrementing
50
50
51
51
If you just want to get the views for an id and don't want to increment the views during a `GET` request, set `inc` to `false` in your query parameter. (`/x?inc=false`)
52
52
53
+
#### `POST` to add metadata
54
+
55
+
You can add more metadata to the view by posting a JSON payload with the field `meta`. Everything in that meta field will be set on meta in the view object. You can read
56
+
the data out with the `all` option, see below for more info. Example request that will post the browser useragent string:
If you want to get all views for all ids, set the `all` query parameter to `true` on a root request. (i.e. `/?all=true`) If you pass the `all` parameter to an id, all ids starting with that pathname will be included. E.g. `/x?all=true` will match views for `/x`, `/xyz` but not `/y`.
0 commit comments