google-analytics-cli 0.1.0rc1__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/PKG-INFO +69 -17
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/README.md +65 -15
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/install.sh +1 -1
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/pyproject.toml +4 -2
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/agent_cmd.py +25 -3
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/uv.lock +6 -2
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/.github/workflows/ci.yml +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/.github/workflows/release.yml +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/.gitignore +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/.python-version +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/__init__.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/api/__init__.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/api/client.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/auth/__init__.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/auth/credentials.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/auth/oauth.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/auth/service_account.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/__init__.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/access_bindings.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/access_reports.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/account_summaries.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/accounts.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/annotations.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/audiences.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/auth_cmd.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/bigquery_links.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/calculated_metrics.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/channel_groups.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/completions_cmd.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/config_cmd.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/custom_dimensions.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/custom_metrics.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/data_retention.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/data_streams.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/event_create_rules.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/event_edit_rules.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/firebase_links.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/google_ads_links.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/key_events.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/mp_secrets.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/properties.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/property_settings.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/reports.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/upgrade_cmd.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/config/__init__.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/config/constants.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/config/store.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/main.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/utils/__init__.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/utils/describe.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/utils/dry_run.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/utils/errors.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/utils/output.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/utils/pagination.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/__init__.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/conftest.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_access_bindings.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_access_reports.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_account_summaries.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_accounts.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_agent_cmd.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_annotations.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_api_client.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_audiences.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_auth_cmd.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_bigquery_links.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_calculated_metrics.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_channel_groups.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_completions_cmd.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_config_cmd.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_credentials.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_custom_dimensions.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_custom_metrics.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_data_retention.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_data_streams.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_describe.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_dry_run.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_errors.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_event_create_rules.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_event_edit_rules.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_firebase_links.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_google_ads_links.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_install_script.sh +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_key_events.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_mp_secrets.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_output.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_pagination.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_properties.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_property_settings.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_quiet_nocolor.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_reports.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_reports_batch.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_reports_funnel.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_reports_pivot.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_service_account.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_upgrade_cmd.py +0 -0
- {google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-analytics-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Command-line interface for Google Analytics 4
|
|
5
5
|
Project-URL: Homepage, https://github.com/daidalytics/google-analytics-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/daidalytics/google-analytics-cli
|
|
@@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.13
|
|
20
20
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
21
|
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: click>=8.0
|
|
22
23
|
Requires-Dist: google-api-python-client>=2.0
|
|
23
24
|
Requires-Dist: google-auth-oauthlib>=1.0
|
|
24
25
|
Requires-Dist: google-auth>=2.0
|
|
@@ -26,7 +27,8 @@ Requires-Dist: packaging>=23.0
|
|
|
26
27
|
Requires-Dist: platformdirs>=4.0
|
|
27
28
|
Requires-Dist: questionary>=2.0
|
|
28
29
|
Requires-Dist: rich>=13.0
|
|
29
|
-
Requires-Dist:
|
|
30
|
+
Requires-Dist: shellingham>=1.3.0
|
|
31
|
+
Requires-Dist: typer>=0.9.0
|
|
30
32
|
Description-Content-Type: text/markdown
|
|
31
33
|
|
|
32
34
|
# GA CLI
|
|
@@ -37,18 +39,53 @@ Manage GA4 accounts, properties, data streams, and run reports — all from your
|
|
|
37
39
|
|
|
38
40
|
## Features
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
### Authentication
|
|
43
|
+
|
|
44
|
+
- **OAuth 2.0** — Browser-based login flow with automatic token refresh
|
|
45
|
+
- **Service accounts** — Key-file authentication for CI/CD and server environments
|
|
46
|
+
|
|
47
|
+
### [GA4 Data API](https://developers.google.com/analytics/devguides/reporting/data/v1)
|
|
48
|
+
|
|
49
|
+
- **Reporting** — Run standard, pivot, batch, funnel, and real-time reports
|
|
50
|
+
- **Report builder** — Interactive metric/dimension selection via `ga reports build`
|
|
51
|
+
- **Compatibility checks** — Validate metric/dimension combinations before running reports
|
|
52
|
+
- **Metadata** — Browse and search available metrics and dimensions
|
|
53
|
+
|
|
54
|
+
### [GA4 Admin API](https://developers.google.com/analytics/devguides/config/admin/v1)
|
|
55
|
+
|
|
56
|
+
- **Accounts** — List, inspect, update, delete accounts; view data sharing settings and change history
|
|
57
|
+
- **Account summaries** — Quick overview of all accounts and their properties
|
|
58
|
+
- **Properties** — List, create, inspect, update, delete properties; acknowledge user data collection; view API quotas
|
|
59
|
+
- **Data streams** — List, create, inspect, update, and delete web, Android, and iOS data streams
|
|
60
|
+
- **Custom dimensions & metrics** — List, create, inspect, update, and archive custom definitions
|
|
61
|
+
- **Calculated metrics** — List, create, inspect, update, and delete calculated metrics
|
|
62
|
+
- **Key events** — List, create, inspect, update, and delete key events (conversions)
|
|
63
|
+
- **Audiences** — List, create, inspect, update, and archive audiences
|
|
64
|
+
- **Access bindings** — Manage user-role assignments at account and property level
|
|
65
|
+
- **Access reports** — Run data-access reports (who accessed what) at account or property level
|
|
66
|
+
- **Data retention** — View and update event and user data retention settings
|
|
67
|
+
- **Annotations** — Create, update, and delete reporting data annotations
|
|
68
|
+
- **Measurement Protocol secrets** — Manage MP API secrets per data stream
|
|
69
|
+
- **BigQuery links** — List, create, update, and delete BigQuery export links
|
|
70
|
+
- **Channel groups** — Manage custom channel groupings
|
|
71
|
+
- **Event create & edit rules** — Manage server-side event creation and modification rules
|
|
72
|
+
- **Firebase links** — List, create, and delete Firebase project links
|
|
73
|
+
- **Google Ads links** — List, create, update, and delete Google Ads account links
|
|
74
|
+
- **Property settings** — View and update attribution, Google Signals, and enhanced measurement settings
|
|
75
|
+
|
|
76
|
+
### Interactive usage
|
|
77
|
+
|
|
47
78
|
- **Flexible output** — Table (default), JSON, and compact output formats
|
|
48
|
-
- **Self-update** — Check for and install updates via `ga upgrade`
|
|
49
|
-
- **Schema introspection** — `ga --describe` outputs JSON Schema for all commands (agent/MCP-ready)
|
|
50
79
|
- **Shell completions** — Generate completion scripts for bash, zsh, and fish
|
|
51
80
|
- **Interactive setup** — Guided configuration wizard via `ga config setup`
|
|
81
|
+
- **Self-update** — Check for and install updates via `ga upgrade`
|
|
82
|
+
|
|
83
|
+
### Automation & agent integration
|
|
84
|
+
|
|
85
|
+
- **Schema introspection** — `ga --describe` outputs JSON Schema for all commands (MCP/agent-ready)
|
|
86
|
+
- **Dry run** — Preview mutative requests (create, update, delete) without executing them
|
|
87
|
+
- **Structured errors** — Categorized exit codes and JSON error output for programmatic handling
|
|
88
|
+
- **Agent guide** — Built-in AI agent quick reference via `ga agent guide`
|
|
52
89
|
|
|
53
90
|
## Installation
|
|
54
91
|
|
|
@@ -170,16 +207,31 @@ export GA_CLI_SERVICE_ACCOUNT="/path/to/key.json"
|
|
|
170
207
|
|
|
171
208
|
| Command | Subcommands | Description |
|
|
172
209
|
|---------|-------------|-------------|
|
|
173
|
-
| `ga auth` | `login`, `logout`, `status` | Manage authentication |
|
|
210
|
+
| `ga auth` | `setup`, `login`, `logout`, `status` | Manage authentication |
|
|
174
211
|
| `ga config` | `setup`, `get`, `set`, `unset`, `path`, `reset` | Manage CLI configuration |
|
|
175
|
-
| `ga accounts` | `list`, `get`, `update`
|
|
212
|
+
| `ga accounts` | `list`, `get`, `update`, `delete`, `get-data-sharing`, `change-history` | Manage GA4 accounts |
|
|
176
213
|
| `ga account-summaries` | `list` | Quick overview of all accounts and properties |
|
|
177
|
-
| `ga properties` | `list`, `get`, `create`, `update`, `delete` | Manage GA4 properties |
|
|
214
|
+
| `ga properties` | `list`, `get`, `create`, `update`, `delete`, `acknowledge-udc`, `quotas` | Manage GA4 properties |
|
|
178
215
|
| `ga custom-dimensions` | `list`, `get`, `create`, `update`, `archive` | Manage custom dimensions |
|
|
179
216
|
| `ga custom-metrics` | `list`, `get`, `create`, `update`, `archive` | Manage custom metrics |
|
|
217
|
+
| `ga calculated-metrics` | `list`, `get`, `create`, `update`, `delete` | Manage calculated metrics |
|
|
180
218
|
| `ga data-streams` | `list`, `get`, `create`, `update`, `delete` | Manage data streams |
|
|
181
219
|
| `ga key-events` | `list`, `get`, `create`, `update`, `delete` | Manage key events (conversions) |
|
|
182
|
-
| `ga
|
|
220
|
+
| `ga audiences` | `list`, `get`, `create`, `update`, `archive` | Manage audiences |
|
|
221
|
+
| `ga access-bindings` | `list`, `get`, `create`, `update`, `delete` | Manage user-role assignments |
|
|
222
|
+
| `ga access-reports` | `run-account`, `run-property` | Run data-access reports |
|
|
223
|
+
| `ga data-retention` | `get`, `update` | View and update data retention settings |
|
|
224
|
+
| `ga annotations` | `list`, `get`, `create`, `update`, `delete` | Manage reporting annotations |
|
|
225
|
+
| `ga mp-secrets` | `list`, `get`, `create`, `update`, `delete` | Manage Measurement Protocol secrets |
|
|
226
|
+
| `ga bigquery-links` | `list`, `get`, `create`, `update`, `delete` | Manage BigQuery export links |
|
|
227
|
+
| `ga channel-groups` | `list`, `get`, `create`, `update`, `delete` | Manage custom channel groups |
|
|
228
|
+
| `ga event-create-rules` | `list`, `get`, `create`, `update`, `delete` | Manage event creation rules |
|
|
229
|
+
| `ga event-edit-rules` | `list`, `get`, `create`, `update`, `delete`, `reorder` | Manage event editing rules |
|
|
230
|
+
| `ga firebase-links` | `list`, `create`, `delete` | Manage Firebase links |
|
|
231
|
+
| `ga google-ads-links` | `list`, `create`, `update`, `delete` | Manage Google Ads links |
|
|
232
|
+
| `ga property-settings` | `attribution`, `google-signals`, `enhanced-measurement` | View and update property settings |
|
|
233
|
+
| `ga reports` | `run`, `pivot`, `batch`, `funnel`, `check-compatibility`, `metadata`, `realtime`, `build` | Run and build reports |
|
|
234
|
+
| `ga agent` | `guide` | AI agent quick reference |
|
|
183
235
|
| `ga upgrade` | `--check`, `--force` | Check for and install updates |
|
|
184
236
|
| `ga completions` | `bash`, `zsh`, `fish` | Generate shell completion scripts |
|
|
185
237
|
|
|
@@ -217,11 +269,11 @@ ga completions fish > ~/.config/fish/completions/ga.fish
|
|
|
217
269
|
|
|
218
270
|
| Variable | Description |
|
|
219
271
|
|----------|-------------|
|
|
272
|
+
| `GA_CLI_CLIENT_ID` | OAuth client ID (alternative to client_secret.json) |
|
|
273
|
+
| `GA_CLI_CLIENT_SECRET` | OAuth client secret (alternative to client_secret.json) |
|
|
220
274
|
| `GA_CLI_SERVICE_ACCOUNT` | Path to service account key file |
|
|
221
275
|
| `GOOGLE_APPLICATION_CREDENTIALS` | Standard GCP credential path (fallback) |
|
|
222
276
|
| `GA_CLI_CONFIG_DIR` | Override config directory |
|
|
223
|
-
| `GA_CLI_CLIENT_ID` | OAuth client ID (alternative to client_secret.json) |
|
|
224
|
-
| `GA_CLI_CLIENT_SECRET` | OAuth client secret (alternative to client_secret.json) |
|
|
225
277
|
| `NO_COLOR` | Disable colored output |
|
|
226
278
|
|
|
227
279
|
## CI/CD Integration
|
|
@@ -6,18 +6,53 @@ Manage GA4 accounts, properties, data streams, and run reports — all from your
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
### Authentication
|
|
10
|
+
|
|
11
|
+
- **OAuth 2.0** — Browser-based login flow with automatic token refresh
|
|
12
|
+
- **Service accounts** — Key-file authentication for CI/CD and server environments
|
|
13
|
+
|
|
14
|
+
### [GA4 Data API](https://developers.google.com/analytics/devguides/reporting/data/v1)
|
|
15
|
+
|
|
16
|
+
- **Reporting** — Run standard, pivot, batch, funnel, and real-time reports
|
|
17
|
+
- **Report builder** — Interactive metric/dimension selection via `ga reports build`
|
|
18
|
+
- **Compatibility checks** — Validate metric/dimension combinations before running reports
|
|
19
|
+
- **Metadata** — Browse and search available metrics and dimensions
|
|
20
|
+
|
|
21
|
+
### [GA4 Admin API](https://developers.google.com/analytics/devguides/config/admin/v1)
|
|
22
|
+
|
|
23
|
+
- **Accounts** — List, inspect, update, delete accounts; view data sharing settings and change history
|
|
24
|
+
- **Account summaries** — Quick overview of all accounts and their properties
|
|
25
|
+
- **Properties** — List, create, inspect, update, delete properties; acknowledge user data collection; view API quotas
|
|
26
|
+
- **Data streams** — List, create, inspect, update, and delete web, Android, and iOS data streams
|
|
27
|
+
- **Custom dimensions & metrics** — List, create, inspect, update, and archive custom definitions
|
|
28
|
+
- **Calculated metrics** — List, create, inspect, update, and delete calculated metrics
|
|
29
|
+
- **Key events** — List, create, inspect, update, and delete key events (conversions)
|
|
30
|
+
- **Audiences** — List, create, inspect, update, and archive audiences
|
|
31
|
+
- **Access bindings** — Manage user-role assignments at account and property level
|
|
32
|
+
- **Access reports** — Run data-access reports (who accessed what) at account or property level
|
|
33
|
+
- **Data retention** — View and update event and user data retention settings
|
|
34
|
+
- **Annotations** — Create, update, and delete reporting data annotations
|
|
35
|
+
- **Measurement Protocol secrets** — Manage MP API secrets per data stream
|
|
36
|
+
- **BigQuery links** — List, create, update, and delete BigQuery export links
|
|
37
|
+
- **Channel groups** — Manage custom channel groupings
|
|
38
|
+
- **Event create & edit rules** — Manage server-side event creation and modification rules
|
|
39
|
+
- **Firebase links** — List, create, and delete Firebase project links
|
|
40
|
+
- **Google Ads links** — List, create, update, and delete Google Ads account links
|
|
41
|
+
- **Property settings** — View and update attribution, Google Signals, and enhanced measurement settings
|
|
42
|
+
|
|
43
|
+
### Interactive usage
|
|
44
|
+
|
|
16
45
|
- **Flexible output** — Table (default), JSON, and compact output formats
|
|
17
|
-
- **Self-update** — Check for and install updates via `ga upgrade`
|
|
18
|
-
- **Schema introspection** — `ga --describe` outputs JSON Schema for all commands (agent/MCP-ready)
|
|
19
46
|
- **Shell completions** — Generate completion scripts for bash, zsh, and fish
|
|
20
47
|
- **Interactive setup** — Guided configuration wizard via `ga config setup`
|
|
48
|
+
- **Self-update** — Check for and install updates via `ga upgrade`
|
|
49
|
+
|
|
50
|
+
### Automation & agent integration
|
|
51
|
+
|
|
52
|
+
- **Schema introspection** — `ga --describe` outputs JSON Schema for all commands (MCP/agent-ready)
|
|
53
|
+
- **Dry run** — Preview mutative requests (create, update, delete) without executing them
|
|
54
|
+
- **Structured errors** — Categorized exit codes and JSON error output for programmatic handling
|
|
55
|
+
- **Agent guide** — Built-in AI agent quick reference via `ga agent guide`
|
|
21
56
|
|
|
22
57
|
## Installation
|
|
23
58
|
|
|
@@ -139,16 +174,31 @@ export GA_CLI_SERVICE_ACCOUNT="/path/to/key.json"
|
|
|
139
174
|
|
|
140
175
|
| Command | Subcommands | Description |
|
|
141
176
|
|---------|-------------|-------------|
|
|
142
|
-
| `ga auth` | `login`, `logout`, `status` | Manage authentication |
|
|
177
|
+
| `ga auth` | `setup`, `login`, `logout`, `status` | Manage authentication |
|
|
143
178
|
| `ga config` | `setup`, `get`, `set`, `unset`, `path`, `reset` | Manage CLI configuration |
|
|
144
|
-
| `ga accounts` | `list`, `get`, `update`
|
|
179
|
+
| `ga accounts` | `list`, `get`, `update`, `delete`, `get-data-sharing`, `change-history` | Manage GA4 accounts |
|
|
145
180
|
| `ga account-summaries` | `list` | Quick overview of all accounts and properties |
|
|
146
|
-
| `ga properties` | `list`, `get`, `create`, `update`, `delete` | Manage GA4 properties |
|
|
181
|
+
| `ga properties` | `list`, `get`, `create`, `update`, `delete`, `acknowledge-udc`, `quotas` | Manage GA4 properties |
|
|
147
182
|
| `ga custom-dimensions` | `list`, `get`, `create`, `update`, `archive` | Manage custom dimensions |
|
|
148
183
|
| `ga custom-metrics` | `list`, `get`, `create`, `update`, `archive` | Manage custom metrics |
|
|
184
|
+
| `ga calculated-metrics` | `list`, `get`, `create`, `update`, `delete` | Manage calculated metrics |
|
|
149
185
|
| `ga data-streams` | `list`, `get`, `create`, `update`, `delete` | Manage data streams |
|
|
150
186
|
| `ga key-events` | `list`, `get`, `create`, `update`, `delete` | Manage key events (conversions) |
|
|
151
|
-
| `ga
|
|
187
|
+
| `ga audiences` | `list`, `get`, `create`, `update`, `archive` | Manage audiences |
|
|
188
|
+
| `ga access-bindings` | `list`, `get`, `create`, `update`, `delete` | Manage user-role assignments |
|
|
189
|
+
| `ga access-reports` | `run-account`, `run-property` | Run data-access reports |
|
|
190
|
+
| `ga data-retention` | `get`, `update` | View and update data retention settings |
|
|
191
|
+
| `ga annotations` | `list`, `get`, `create`, `update`, `delete` | Manage reporting annotations |
|
|
192
|
+
| `ga mp-secrets` | `list`, `get`, `create`, `update`, `delete` | Manage Measurement Protocol secrets |
|
|
193
|
+
| `ga bigquery-links` | `list`, `get`, `create`, `update`, `delete` | Manage BigQuery export links |
|
|
194
|
+
| `ga channel-groups` | `list`, `get`, `create`, `update`, `delete` | Manage custom channel groups |
|
|
195
|
+
| `ga event-create-rules` | `list`, `get`, `create`, `update`, `delete` | Manage event creation rules |
|
|
196
|
+
| `ga event-edit-rules` | `list`, `get`, `create`, `update`, `delete`, `reorder` | Manage event editing rules |
|
|
197
|
+
| `ga firebase-links` | `list`, `create`, `delete` | Manage Firebase links |
|
|
198
|
+
| `ga google-ads-links` | `list`, `create`, `update`, `delete` | Manage Google Ads links |
|
|
199
|
+
| `ga property-settings` | `attribution`, `google-signals`, `enhanced-measurement` | View and update property settings |
|
|
200
|
+
| `ga reports` | `run`, `pivot`, `batch`, `funnel`, `check-compatibility`, `metadata`, `realtime`, `build` | Run and build reports |
|
|
201
|
+
| `ga agent` | `guide` | AI agent quick reference |
|
|
152
202
|
| `ga upgrade` | `--check`, `--force` | Check for and install updates |
|
|
153
203
|
| `ga completions` | `bash`, `zsh`, `fish` | Generate shell completion scripts |
|
|
154
204
|
|
|
@@ -186,11 +236,11 @@ ga completions fish > ~/.config/fish/completions/ga.fish
|
|
|
186
236
|
|
|
187
237
|
| Variable | Description |
|
|
188
238
|
|----------|-------------|
|
|
239
|
+
| `GA_CLI_CLIENT_ID` | OAuth client ID (alternative to client_secret.json) |
|
|
240
|
+
| `GA_CLI_CLIENT_SECRET` | OAuth client secret (alternative to client_secret.json) |
|
|
189
241
|
| `GA_CLI_SERVICE_ACCOUNT` | Path to service account key file |
|
|
190
242
|
| `GOOGLE_APPLICATION_CREDENTIALS` | Standard GCP credential path (fallback) |
|
|
191
243
|
| `GA_CLI_CONFIG_DIR` | Override config directory |
|
|
192
|
-
| `GA_CLI_CLIENT_ID` | OAuth client ID (alternative to client_secret.json) |
|
|
193
|
-
| `GA_CLI_CLIENT_SECRET` | OAuth client secret (alternative to client_secret.json) |
|
|
194
244
|
| `NO_COLOR` | Disable colored output |
|
|
195
245
|
|
|
196
246
|
## CI/CD Integration
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "google-analytics-cli"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.1"
|
|
4
4
|
description = "Command-line interface for Google Analytics 4"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -20,7 +20,9 @@ classifiers = [
|
|
|
20
20
|
"Topic :: Internet :: WWW/HTTP",
|
|
21
21
|
]
|
|
22
22
|
dependencies = [
|
|
23
|
-
"typer
|
|
23
|
+
"typer>=0.9.0",
|
|
24
|
+
"click>=8.0",
|
|
25
|
+
"shellingham>=1.3.0",
|
|
24
26
|
"google-api-python-client>=2.0",
|
|
25
27
|
"google-auth-oauthlib>=1.0",
|
|
26
28
|
"google-auth>=2.0",
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/agent_cmd.py
RENAMED
|
@@ -74,7 +74,7 @@ ga account-summaries list [-o json]
|
|
|
74
74
|
|
|
75
75
|
### Properties
|
|
76
76
|
```bash
|
|
77
|
-
ga properties list [-a ACCOUNT_ID] [-o json]
|
|
77
|
+
ga properties list [-a ACCOUNT_ID] [-o json] # pipe: | jq '.[] | select(.displayName | test("prod"; "i"))'
|
|
78
78
|
ga properties get [-p PROPERTY_ID] [-o json]
|
|
79
79
|
ga properties create -a ACCOUNT_ID --name "Name" [--timezone TZ] [--currency CODE]
|
|
80
80
|
ga properties update -p PROPERTY_ID [--name NAME] [--timezone TZ] [--currency CODE] [--industry CAT]
|
|
@@ -237,7 +237,7 @@ Get/set hybrid: no update flags = GET, any update flag = PATCH. Enhanced measure
|
|
|
237
237
|
|
|
238
238
|
### Reports
|
|
239
239
|
```bash
|
|
240
|
-
ga reports run [-p PROPERTY_ID] -m metrics -d dimensions --start-date DATE --end-date DATE [--limit N] [-o json]
|
|
240
|
+
ga reports run [-p PROPERTY_ID] -m metrics -d dimensions --start-date DATE --end-date DATE [--limit N] [-o json] # pipe: | jq '[.[] | {date, sessions, users}]'
|
|
241
241
|
ga reports pivot [-p PROPERTY_ID] -m metrics -d dimensions --pivot-field FIELD [--start-date DATE] [-o json]
|
|
242
242
|
ga reports check-compatibility [-p PROPERTY_ID] [-m metrics] [-d dimensions] [-o json]
|
|
243
243
|
ga reports metadata [-p PROPERTY_ID] [--type metrics|dimensions] [--search TEXT] [-o json]
|
|
@@ -263,6 +263,28 @@ ga completions bash|zsh|fish
|
|
|
263
263
|
| `GA_CLI_CONFIG_DIR` | Override config directory |
|
|
264
264
|
| `NO_COLOR` | Disable colored output |
|
|
265
265
|
|
|
266
|
+
## Parsing Output
|
|
267
|
+
|
|
268
|
+
`-o json` produces machine-parseable output **meant for jq**. Always pipe through jq — never parse raw JSON manually.
|
|
269
|
+
|
|
270
|
+
### Reusable jq recipes
|
|
271
|
+
```bash
|
|
272
|
+
# Extract numeric IDs from resource names ("accounts/123" → "123")
|
|
273
|
+
ga accounts list -o json | jq -r '.[].name' | grep -o '[0-9]*$'
|
|
274
|
+
|
|
275
|
+
# Filter resources by display name (case-insensitive regex)
|
|
276
|
+
ga properties list -o json | jq '.[] | select(.displayName | test("prod"; "i"))'
|
|
277
|
+
|
|
278
|
+
# Pick specific fields
|
|
279
|
+
ga data-streams list -o json | jq '[.[] | {id: (.name | split("/") | last), displayName, type}]'
|
|
280
|
+
|
|
281
|
+
# Count results
|
|
282
|
+
ga custom-dimensions list -o json | jq 'length'
|
|
283
|
+
|
|
284
|
+
# Get first result's ID (useful for chaining)
|
|
285
|
+
ga properties list -o json | jq -r '.[0].name' | grep -o '[0-9]*$'
|
|
286
|
+
```
|
|
287
|
+
|
|
266
288
|
## Agent Workflow
|
|
267
289
|
Typical discover → act pattern:
|
|
268
290
|
```bash
|
|
@@ -299,7 +321,7 @@ ga data-streams list -o json | jq -r '.[].name' | grep -o '[0-9]*$'
|
|
|
299
321
|
- **Start with `ga --describe`** — discover every command, parameter, type, and flag in one JSON call; cache the result
|
|
300
322
|
- **Use `--dry-run` before mutations** — preview the exact API request before executing creates, updates, and deletes
|
|
301
323
|
- **Set defaults first** — eliminates repetitive `--account-id` / `--property-id` flags from every command
|
|
302
|
-
- **Always use `-o json`** —
|
|
324
|
+
- **Always use `-o json` and pipe through `jq`** — JSON output is machine-parseable; always pipe through `jq` to filter, extract IDs, or reshape — never parse raw output manually (see "Parsing Output" above)
|
|
303
325
|
- **Use `check-compatibility` before complex reports** — avoids API errors from incompatible metric/dimension combos
|
|
304
326
|
- **Use `metadata` to discover available metrics/dimensions** — `ga reports metadata -p ID --search revenue -o json`
|
|
305
327
|
- **Parallelize independent operations** — run creates/deletes concurrently with `&` and `wait`
|
|
@@ -306,9 +306,10 @@ wheels = [
|
|
|
306
306
|
|
|
307
307
|
[[package]]
|
|
308
308
|
name = "google-analytics-cli"
|
|
309
|
-
version = "0.1.
|
|
309
|
+
version = "0.1.1"
|
|
310
310
|
source = { editable = "." }
|
|
311
311
|
dependencies = [
|
|
312
|
+
{ name = "click" },
|
|
312
313
|
{ name = "google-api-python-client" },
|
|
313
314
|
{ name = "google-auth" },
|
|
314
315
|
{ name = "google-auth-oauthlib" },
|
|
@@ -316,6 +317,7 @@ dependencies = [
|
|
|
316
317
|
{ name = "platformdirs" },
|
|
317
318
|
{ name = "questionary" },
|
|
318
319
|
{ name = "rich" },
|
|
320
|
+
{ name = "shellingham" },
|
|
319
321
|
{ name = "typer" },
|
|
320
322
|
]
|
|
321
323
|
|
|
@@ -327,6 +329,7 @@ dev = [
|
|
|
327
329
|
|
|
328
330
|
[package.metadata]
|
|
329
331
|
requires-dist = [
|
|
332
|
+
{ name = "click", specifier = ">=8.0" },
|
|
330
333
|
{ name = "google-api-python-client", specifier = ">=2.0" },
|
|
331
334
|
{ name = "google-auth", specifier = ">=2.0" },
|
|
332
335
|
{ name = "google-auth-oauthlib", specifier = ">=1.0" },
|
|
@@ -334,7 +337,8 @@ requires-dist = [
|
|
|
334
337
|
{ name = "platformdirs", specifier = ">=4.0" },
|
|
335
338
|
{ name = "questionary", specifier = ">=2.0" },
|
|
336
339
|
{ name = "rich", specifier = ">=13.0" },
|
|
337
|
-
{ name = "
|
|
340
|
+
{ name = "shellingham", specifier = ">=1.3.0" },
|
|
341
|
+
{ name = "typer", specifier = ">=0.9.0" },
|
|
338
342
|
]
|
|
339
343
|
|
|
340
344
|
[package.metadata.requires-dev]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/auth/service_account.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/__init__.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/access_bindings.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/access_reports.py
RENAMED
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/accounts.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/annotations.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/audiences.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/auth_cmd.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/bigquery_links.py
RENAMED
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/channel_groups.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/completions_cmd.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/config_cmd.py
RENAMED
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/custom_metrics.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/data_retention.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/data_streams.py
RENAMED
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/event_edit_rules.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/firebase_links.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/google_ads_links.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/key_events.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/mp_secrets.py
RENAMED
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/properties.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/src/ga_cli/commands/upgrade_cmd.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_account_summaries.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_calculated_metrics.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_custom_dimensions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_event_create_rules.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{google_analytics_cli-0.1.0rc1 → google_analytics_cli-0.1.1}/tests/test_property_settings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|