The GoatCounter export is a CSV export of all pageviews of a site.
There is no “standard” CSV; the export is created with the encoding/csv
package. Some notes:
\n
or \r\n
."
: hello,"world"
"
inside a quoted field by doubling it up: hello,"""world"""
The first line is a header with the field names. The fields, in order, are:
2,Path | Path name (e.g. /a.html ).
This also doubles as the event name. This header is prefixed
with the version export format (see versioning below). |
---|---|
Title | Page title that was sent. |
Event | If this is an event; true or false . |
User-Agent | User-Agent header. |
Browser | Browser name and version. |
System | System name and version. |
Session | The session ID, to track unique visitors. |
Bot | If this is a bot request; 0 if it's
not, or one of the
isbot
constants if it is. |
Referrer | Referrer data. |
Referrer scheme |
h – HTTP; an URL;g – Generated; e.g. all the various Hacker News interfaces don't
add a link to the specific story, so are just recorded as “Hacker News”;c – Campaign; text string from a campaign parameter;o – Other (e.g. Android apps).
|
Screen size | Screen size as x,y,scaling . |
Location | ISO 3166-2 country code (either "US" or "US-TX") |
FirstVisit | First visit in this session? |
Date | Creation date as RFC 3339/ISO 8601. |
The format of the CSV file may change in the future; the version of the export file is recorded at the start of the header as a number. It’s strongly recommended to check this number if you’re using a script to import/sync data and error out if it changes. Any future incompatibilities will be documented here.
Version 1 documentation
The first line is a header with the field names. The fields, in order, are:
1,Path | Path name (e.g. /a.html ).
This also doubles as the event name. This header is prefixed
with the version export format (see versioning below). |
---|---|
Title | Page title that was sent. |
Event | If this is an event; true or false . |
Bot | If this is a bot request; 0 if it’s
not, or one of the
isbot
constants if it is. |
Session | The session ID, to track unique visitors. |
FirstVisit | First visit in this session? |
Referrer | Referrer data. |
Referrer scheme |
h – HTTP; an URL;g – Generated; e.g. all the various Hacker News interfaces don’t
add a link to the specific story, so are just recorded as “Hacker News”;c – Campaign; text string from a campaign parameter;o – Other (e.g. Android apps).
|
Browser | User-Agent header. |
Screen size | Screen size as x,y,scaling . |
Location | ISO 3166-1 country code. |
Date | Creation date as RFC 3339/ISO 8601. |
If you want to run analytics on this, you can use e.g. SQLite:
sqlite> .import --csv gc_export.csv gc_export
sqlite> select
...> count(*) as count,
...> substr(Location, 0, 3) as location
...> from gc_export
...> where location != ''
...> group by location
...> order by count desc
...> limit 20;
┌────────┬──────────┐
│ count │ location │
├────────┼──────────┤
│ 113144 │ US │
│ 27092 │ DE │
│ 24131 │ GB │
│ 13269 │ CA │
│ 12977 │ FR │
│ 9785 │ NL │
│ 8150 │ IN │
│ 7487 │ AU │
│ 6864 │ PL │
│ 6760 │ SE │
└────────┴──────────┘
Or PostgreSQL:
=# create table gc_export (
"2Path" varchar,
"Title" varchar,
"Event" varchar,
"UserAgent" varchar,
"Browser" varchar,
"System" varchar,
"Session" varchar,
"Bot" varchar,
"Referrer" varchar,
"Referrer scheme" varchar,
"Screen size" varchar,
"Location" varchar,
"FirstVisit" varchar,
"Date" varchar
);
=# \copy gc_export from 'gc_export.csv' with (format csv, header on);
Feel free to get in touch if you’ve got any questions or having any problems; a lot of times they can be resolved without too much problems.
Ways to contact me: show