CSV Export

Tally provides CSV export endpoints for all raw data. These are useful for importing into spreadsheets, data warehouses, or custom reporting tools.

Export pageviews

GET /api/v1/export/pageviews?site_id=blog&period=30d

Returns one row per pageview with columns:

page_path, page_title, session_id, referrer, entered_at, exited_at,
focus_time_ms, scroll_depth, word_count

Export sessions

GET /api/v1/export/sessions?site_id=blog&period=30d

Returns one row per session with columns:

session_id, ip, city, region, country, latitude, longitude,
browser, browser_version, os, os_version, device_type,
referrer_source, referrer_medium, utm_source, utm_medium, utm_campaign,
first_seen_at, last_seen_at

Export pages summary

GET /api/v1/export/pages?site_id=blog&period=30d

Returns one row per page with aggregated metrics:

page_path, page_title, views, unique_views, avg_focus_time_ms, avg_scroll_depth

Usage examples

Download with curl

curl -H "Authorization: Bearer your-api-key"   "https://your-tally-server.com/api/v1/export/pageviews?period=30d"   -o pageviews.csv

Import into SQLite

sqlite3 analytics.db ".mode csv" ".import pageviews.csv pageviews_export"

Pipe into duckdb

curl -s -H "Authorization: Bearer $KEY"   "https://tally.example.com/api/v1/export/pageviews?period=7d" |
  duckdb -c "COPY read_csv_auto('/dev/stdin') TO 'pageviews.parquet' (FORMAT PARQUET);"

Spreadsheet safety: Visitor-supplied text (page titles, referrers, UTM values) can contain cells that look like spreadsheet formulas. Exports neutralize any text cell starting with =, +, -, @, or a tab/CR by prefixing it with an apostrophe, so opening the CSV in Excel, Sheets, or LibreOffice shows it as text. Numeric columns are untouched. If you need the raw unmodified values for programmatic ingestion, read the SQLite database directly instead.

Tip: Timestamps in CSV exports are ISO 8601 UTC format. You can filter by date range using start and end parameters (YYYY-MM-DD format).