Skip to content

Commit e171b17

Browse files
committed
Add documentation regarding multi-vhost
1 parent 7052300 commit e171b17

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

tpl/help/domains.md

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,14 @@
1-
GoatCounter doesn’t store the domain a pageview belongs to; if you add
2-
GoatCounter to several (sub)domains then there’s no way to distinguish between
3-
requests to `a.example.com/path` and `b.example.com/path` as they’re both
4-
recorded as `/path`.
1+
GoatCounter *does*, optionally, store the domain a pageview belongs to;
2+
If the log importer script is run with `$host` in the log format, or uses a
3+
format that includes that, such as `combined-vhost`, `common-vhost`, `bunny`.
54

6-
This might be improved at some point in the future; the options right now are:
5+
Currently, javascript api `count.js`, does not support doing this.
76

8-
1. Create a new site for every domain; this is a completely separate site which
9-
has the same user, login, etc. You will need to use a different site for
10-
every (sub)domain.
7+
To report a host via the raw API include the `host` field within the `hits` list, such as:
118

12-
2. If you want everything in a single overview then you can add the domain to
13-
the path, instead of just sending the path:
14-
15-
<script>
16-
window.goatcounter = {
17-
path: function(p) { return location.host + p }
18-
}
19-
</script>
20-
{{template "code" .}}
21-
22-
For subdomains it it might be more useful to just add the first domain label
23-
instead of the full domain here, or perhaps just a short static string
24-
identifying the source.
25-
26-
27-
Also see [setting the endpoint in JavaScript]({{.Base}}/code/modify#setting-the-endpoint-in-javascript-4).
9+
```
10+
curl -X POST "$api/count" \
11+
-H 'Content-Type: application/json' \
12+
-H "Authorization: Bearer $token" \
13+
--data '{"no_sessions": true, "hits": [{"host": "example.org", "path": "/one"}]}'
14+
```

0 commit comments

Comments
 (0)