Google Analytics 4 Data Retrieval Tool
Or install as part of the complete KanmiLabs suite:
Secure authentication with Google Analytics using industry-standard OAuth2 flow.
Generate custom reports, comparisons, top events analysis, and page performance reports.
Export data as Table, JSON, Markdown, or CSV formats for different use cases.
Compare current performance against previous periods with automatic calculations.
Save reports directly to files with customizable naming and location.
Use any GA4 metric and dimension combination for custom analysis.
credentials.json in your project directory or specify the path using environment variables.
| Command | Description | Options |
|---|---|---|
ga4-cli auth |
Authenticate with Google Analytics | --reset |
ga4-cli properties |
List available GA4 properties | --format |
ga4-cli report |
Generate custom reports | --property, --metrics, --dimensions, --date-range |
ga4-cli compare |
Compare time periods | --property, --current, --previous |
ga4-cli top-events |
Analyze top events | --property, --limit, --date-range |
ga4-cli top-pages |
Analyze top pages | --property, --limit, --date-range |
GA4 CLI supports all standard GA4 metrics and dimensions. Common examples:
sessions - Number of sessionsusers - Number of userspageviews - Number of page viewsbounceRate - Bounce rate percentageavgSessionDuration - Average session durationconversions - Number of conversionstotalRevenue - Total revenuedate - Datecountry - Countrycity - CitydeviceCategory - Device categorysource - Traffic sourcemedium - Traffic mediumcampaign - Campaign namepagePath - Page path