CLI Tool

RevKlik CLI

Akses analytics dari terminal Anda. Install via npm, login dengan API token, dan query data analytics langsung dari command line — atau pipe ke jq untuk pipeline otomatis.

Instalasi

Install CLI secara global via npm. Butuh Node.js 18+.

$ npm install -g @revklik/cli

Setelah install, perintah revklik tersedia di terminal Anda.

$ revklik --version 1.2.0 $ revklik --help RevKlik CLI — Analytics from your terminal Commands: revklik login Authenticate with API token revklik whoami Show current auth info revklik sites list List your sites revklik analytics overview Show analytics summary revklik analytics events Raw event log revklik analytics timeseries Time series data revklik analytics pages Top pages revklik analytics referrers Traffic sources revklik analytics geo Geo breakdown revklik analytics journeys Customer journey summaries revklik analytics export Export data (CSV/JSON) revklik tokens list List API tokens revklik tokens create Create new token revklik tokens revoke Revoke a token Flags: --json Output raw JSON --verbose Debug output --help Show help

Login

Autentikasi menggunakan API token dari dashboard RevKlik. Buat token di Settings > API Tokens.

Dengan Token

$ revklik login --token rvt_a1b2c3d4e5f6... Token saved to ~/.config/revklik/config.json Logged in as john@example.com (starter plan)

Interactive Login

$ revklik login Enter your API token: **** Token saved. Logged in as john@example.com
Tip: Buat account token (rvt_) dengan scope sites:read dan analytics:read untuk CLI. Jangan gunakan session token kp_.

Whoami

Tampilkan informasi tentang token yang sedang aktif.

$ revklik whoami User: John Doe (john@example.com) Plan: starter Token: My CLI Token (account) Scopes: sites:read, analytics:read, analytics:export Created: 2026-05-15

Sites

revklik sites list

Tampilkan semua sites yang terdaftar di akun Anda.

$ revklik sites list ID Name Domain ────────────── ───────────────── ────────────────── site_abc123 My Website mysite.com site_def456 Blog blog.mysite.com
$ revklik sites list --json [{"id":"site_abc123","name":"My Website","domain":"mysite.com","created_at":"2026-01-15T00:00:00Z"}]

Analytics

Overview

$ revklik analytics overview --site site_abc123 --range 7d Pageviews 12,483 Visitors 3,241 Sessions 4,812 Bounce Rate 34.2% Avg Duration 4m 12s Revenue Rp 2,490,000 Conversions 87

Timeseries

$ revklik analytics timeseries --site site_abc123 --range 7d Date Pageviews Visitors ─────────── ────────── ───────── 2026-05-09 1,520 412 2026-05-10 1,689 467 2026-05-11 2,104 589 2026-05-12 1,823 501 2026-05-13 1,956 534 2026-05-14 2,341 623 2026-05-15 1,050 315

Top Pages

$ revklik analytics pages --site site_abc123 --range 30d Path Pageviews Visitors ────────────── ────────── ───────── / 4,521 1,892 /pricing 2,104 987 /docs 1,823 756 /blog 1,456 634 /register 1,203 489

Referrers

$ revklik analytics referrers --site site_abc123 --range 7d

Geo

$ revklik analytics geo --site site_abc123 --range 7d Country Region City Visitors ────────────── ────────────── ───────────── ───────── Indonesia Jakarta Jakarta 1,245 Indonesia Jawa Barat Bandung 412 Singapore Central Singapore 289 Malaysia Kuala Lumpur KL 156

Export

$ revklik analytics export --site site_abc123 --range 30d --format csv --type events Exported to analytics_events_2026-05-15.csv

Events

Query raw event log dengan filter type. Lihat setiap pageview, conversion, dan custom event yang tercatat.

$ revklik analytics events --site site_abc123 --range 7d --limit 10 Events — 7d Time Type Path Visitor Country Revenue ───────────────── ────────── ───────────────── ────────── ────────── ──────── 2026-05-20 04:04 pageview / 643a004e ID - 2026-05-20 03:58 conversion /checkout a1b2c3d4 ID $24.00 2026-05-20 03:55 pageview /pricing 643a004e ID - 2026-05-20 03:50 custom /signup e5f6a7b8 SG - 2026-05-20 03:45 pageview / c9d0e1f2 US - Total: 1482 events | Pageviews: 156 | Conversions: 12 | Custom: 89 | Revenue: $288.00
# Filter by event type $ revklik analytics events --site site_abc123 --type conversion --range 30d # Output JSON for pipeline $ revklik analytics events --site site_abc123 --json --limit 100
FlagDescriptionDefault
--typeFilter: pageview, conversion, custom, allall
--limitMax events to show50
--rangeDate range (24h, 7d, 30d, 90d)7d

Customer Journey Summaries

Lihat ringkasan perjalanan pelanggan — siapa yang paling engaged, dari mana mereka datang, dan siapa yang worth untuk di-follow up. Sort berdasarkan steps, revenue, source, device, atau date.

$ revklik analytics journeys --site site_abc123 --sort steps --limit 10 Customer Journeys — 7d Visitor Steps Source Device Revenue Date Country ────────────── ────── ─────────────── ──────── ──────── ───────────────── ──────── John Doe * 16 google desktop $24.00 2026-05-17 02:09 ID 7177428f-cac 10 direct desktop $0.00 2026-05-19 08:44 ID 8885accf-772 10 direct desktop $0.00 2026-05-17 12:26 ID Jane Smith * 5 facebook mobile $12.50 2026-05-17 18:38 SE 2a6084bf-2af 2 facebook desktop $0.00 2026-05-19 08:46 US Total: 10 journeys | Avg steps: 5.0 | Revenue: $36.50 | Converting: 2
# Sort by revenue to find highest-value visitors $ revklik analytics journeys --site site_abc123 --sort revenue --range 30d # Output JSON for pipeline automation $ revklik analytics journeys --site site_abc123 --json --limit 5
FlagDeskripsiDefault
--sortSort by: steps, revenue, source, device, datesteps
--limitMax journeys to show (max 100)20
--rangeDate range: 24h, 7d, 30d, 90d7d

JSON Pipeline

Power user tip: Gunakan flag --json dan pipe ke jq untuk filtering, atau ke script untuk automasi.
# Get bounce rate only $ revklik analytics overview --site site_abc123 --range 7d --json | jq .bounceRate 0.342 # Top 3 pages by visitors $ revklik analytics pages --site site_abc123 --range 7d --json | jq 'sort_by(-.visitors) | .[0:3]' # Export to file $ revklik analytics overview --site site_abc123 --range 30d --json > overview.json

Tokens

revklik tokens list

$ revklik tokens list ID Prefix Name Type Scopes Last Used ────────────── ───────── ───────────────── ───────── ────────────────────── ──────────── tok_abc123 rvt_a1b My CLI Token account sites:read, analytics 2 hours ago tok_def456 rv_x2y3 Site Tracker site analytics:read Never

revklik tokens create

$ revklik tokens create --name "CI Pipeline" --type account Token created! ID: tok_ghi789 Token: rvt_f4g5h6i7j8k9... ⚠ Save this token now — it won't be shown again.

revklik tokens revoke

$ revklik tokens revoke tok_ghi789 Token tok_ghi789 revoked.

Global Flags

FlagDeskripsi
--jsonOutput raw JSON (machine-readable). Cocok untuk pipe ke jq atau script.
--verboseTampilkan debug info: URL, headers, response time.
--helpTampilkan help untuk command apapun.
--versionTampilkan versi CLI.

Environment Variables

VariableDeskripsiDefault
REVKLIK_TOKENAPI token (skip login). Berguna untuk CI/CD.
REVKLIK_API_BASECustom API base URL. Untuk self-hosted.https://app.revklik.com/api

CI/CD Example

# GitHub Actions env: REVKLIK_TOKEN: ${{ secrets.REVKLIK_API_TOKEN }} steps: - run: npx @revklik/cli analytics overview --site $SITE_ID --range 24h --json

Config File

CLI menyimpan konfigurasi di ~/.config/revklik/config.json.

{ "token": "rvt_a1b2c3d4e5f6...", "apiBase": "https://app.revklik.com/api" }

Untuk mengganti token, jalankan revklik login lagi. Token lama akan ditimpa.