POST /api/v0/count
Count pageviews.
§
This can count one or more pageviews. Pageviews are not persisted immediatly, but persisted in the background every 10 seconds.
The maximum amount of pageviews per request is 100.
Errors will have the key set to the index of the pageview. Any pageviews not listed have been processed and shouldn't be sent again.
The response header has the X-Goatcounter-Memstore header set to the time of the last time pageviews were persisted to the database. This is useful if you want to (roughly) sync up with this.
202 Accepted
202 Accepted (no data)
(application/json)400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
GET /api/v0/export/{id}
Get details about an export.
§
200 OK
goatcounter.Export
(application/json)
400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
GET /api/v0/export/{id}/download
Download an export file.
§
200 OK
200 OK (text/csv data)
(text/csv)400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
POST /api/v0/export
Start a new export in the background.
§
This starts a new export in the background.
202 Accepted
goatcounter.Export
(application/json)
400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
GET /api/v0/sites
List the current site and all additional sites.
§
200 OK
handlers.apiSitesResponse
(application/json)
400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
GET /api/v0/sites/{id}
Get information about a site.
§
Get all information about one site.
200 OK
goatcounter.Site
(application/json)
400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
PATCH /api/v0/sites/{id}
Update a site.
§
A POST request will *replace* the entire site with what's sent, blanking out any existing fields that may exist. A PATCH request will only update the fields that are sent.
200 OK
goatcounter.Site
(application/json)
400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
POST /api/v0/sites/{id}
Update a site.
§
A POST request will *replace* the entire site with what's sent, blanking out any existing fields that may exist. A PATCH request will only update the fields that are sent.
200 OK
goatcounter.Site
(application/json)
400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
PUT /api/v0/sites
Create a new site.
§
200 OK
goatcounter.Site
(application/json)
400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
GET /api/v0/me
Get information about the current user and API key.
§
200 OK
handlers.meResponse
(application/json)
400 Bad Request
handlers.apiError
(application/json)
403 Forbidden
handlers.authError
(application/json)
The hit ID this export was started from.
Last hit ID that was exported; can be used as start_from_hit_id.
File size in MB.
SHA256 hash.
Any errors that may have occured.
Custom domain, e.g. "stats.example.com"
When the CNAME was verified.
Domain code (arp242, which makes arp242.goatcounter.com)
Site domain for linking (www.arp242.net).
Whether this site has received any data; will be true after the first pageview.
User entry.
Don't try to count unique visitors; every pageview will be considered a "visit".
Path of the pageview, or the event name.
Page title, or some descriptive event title.
Is this an event?
Referrer value, can be an URL (i.e. the Referal: header) or any string.
Screen size as "x,y,scaling"
Query parameters for this pageview, used to get campaign parameters.
Hint if this should be considered a bot; should be one of the JSBot*` constants from isbot; note the backend may override this if it detects a bot using another method. https://github.com/zgoat/isbot/blob/master/isbot.go#L28
User-Agent header.
Location as ISO-3166-1 alpha2 string (e.g. NL, ID, etc.)
IP to get location from; not used if location is set. Also used for session generation.
Time this pageview should be recorded at; this can be in the past, but not in the future.
Normally a session is based on hash(User-Agent+IP+salt), but if you don't send the IP address then we can't determine the session.
In those cases, you can store your own session identifiers and send them along. Note these will not be stored in the database as the sessionID (just as the hashes aren't), they're just used as a unique grouping identifier.
You can also just disable sessions entirely with NoSessions.
Pagination cursor; only export hits with an ID greater than this.
A Location maps time instants to the zone in use at that time. Typically, the Location represents the collection of time offsets in use in a geographical area. For many Locations the time offset varies depending on whether daylight savings time is in use at the time instant.
Zone represents a time zone.
ID
Asia/Makassar
WITA
Indonesia
Borneo (east, south); Sulawesi/Celebes, Bali, Nusa Tengarra; Timor (west)