google-analytics-cli 0.1.0__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.
Files changed (97) hide show
  1. google_analytics_cli-0.1.0/.github/workflows/ci.yml +30 -0
  2. google_analytics_cli-0.1.0/.github/workflows/release.yml +75 -0
  3. google_analytics_cli-0.1.0/.gitignore +30 -0
  4. google_analytics_cli-0.1.0/.python-version +1 -0
  5. google_analytics_cli-0.1.0/PKG-INFO +321 -0
  6. google_analytics_cli-0.1.0/README.md +288 -0
  7. google_analytics_cli-0.1.0/install.sh +53 -0
  8. google_analytics_cli-0.1.0/pyproject.toml +67 -0
  9. google_analytics_cli-0.1.0/src/ga_cli/__init__.py +8 -0
  10. google_analytics_cli-0.1.0/src/ga_cli/api/__init__.py +0 -0
  11. google_analytics_cli-0.1.0/src/ga_cli/api/client.py +142 -0
  12. google_analytics_cli-0.1.0/src/ga_cli/auth/__init__.py +35 -0
  13. google_analytics_cli-0.1.0/src/ga_cli/auth/credentials.py +126 -0
  14. google_analytics_cli-0.1.0/src/ga_cli/auth/oauth.py +322 -0
  15. google_analytics_cli-0.1.0/src/ga_cli/auth/service_account.py +155 -0
  16. google_analytics_cli-0.1.0/src/ga_cli/commands/__init__.py +0 -0
  17. google_analytics_cli-0.1.0/src/ga_cli/commands/access_bindings.py +254 -0
  18. google_analytics_cli-0.1.0/src/ga_cli/commands/access_reports.py +201 -0
  19. google_analytics_cli-0.1.0/src/ga_cli/commands/account_summaries.py +68 -0
  20. google_analytics_cli-0.1.0/src/ga_cli/commands/accounts.py +297 -0
  21. google_analytics_cli-0.1.0/src/ga_cli/commands/agent_cmd.py +776 -0
  22. google_analytics_cli-0.1.0/src/ga_cli/commands/annotations.py +264 -0
  23. google_analytics_cli-0.1.0/src/ga_cli/commands/audiences.py +223 -0
  24. google_analytics_cli-0.1.0/src/ga_cli/commands/auth_cmd.py +205 -0
  25. google_analytics_cli-0.1.0/src/ga_cli/commands/bigquery_links.py +309 -0
  26. google_analytics_cli-0.1.0/src/ga_cli/commands/calculated_metrics.py +312 -0
  27. google_analytics_cli-0.1.0/src/ga_cli/commands/channel_groups.py +223 -0
  28. google_analytics_cli-0.1.0/src/ga_cli/commands/completions_cmd.py +55 -0
  29. google_analytics_cli-0.1.0/src/ga_cli/commands/config_cmd.py +113 -0
  30. google_analytics_cli-0.1.0/src/ga_cli/commands/custom_dimensions.py +272 -0
  31. google_analytics_cli-0.1.0/src/ga_cli/commands/custom_metrics.py +305 -0
  32. google_analytics_cli-0.1.0/src/ga_cli/commands/data_retention.py +153 -0
  33. google_analytics_cli-0.1.0/src/ga_cli/commands/data_streams.py +277 -0
  34. google_analytics_cli-0.1.0/src/ga_cli/commands/event_create_rules.py +250 -0
  35. google_analytics_cli-0.1.0/src/ga_cli/commands/event_edit_rules.py +292 -0
  36. google_analytics_cli-0.1.0/src/ga_cli/commands/firebase_links.py +142 -0
  37. google_analytics_cli-0.1.0/src/ga_cli/commands/google_ads_links.py +225 -0
  38. google_analytics_cli-0.1.0/src/ga_cli/commands/key_events.py +269 -0
  39. google_analytics_cli-0.1.0/src/ga_cli/commands/mp_secrets.py +265 -0
  40. google_analytics_cli-0.1.0/src/ga_cli/commands/properties.py +330 -0
  41. google_analytics_cli-0.1.0/src/ga_cli/commands/property_settings.py +287 -0
  42. google_analytics_cli-0.1.0/src/ga_cli/commands/reports.py +726 -0
  43. google_analytics_cli-0.1.0/src/ga_cli/commands/upgrade_cmd.py +148 -0
  44. google_analytics_cli-0.1.0/src/ga_cli/config/__init__.py +0 -0
  45. google_analytics_cli-0.1.0/src/ga_cli/config/constants.py +61 -0
  46. google_analytics_cli-0.1.0/src/ga_cli/config/store.py +115 -0
  47. google_analytics_cli-0.1.0/src/ga_cli/main.py +110 -0
  48. google_analytics_cli-0.1.0/src/ga_cli/utils/__init__.py +20 -0
  49. google_analytics_cli-0.1.0/src/ga_cli/utils/describe.py +129 -0
  50. google_analytics_cli-0.1.0/src/ga_cli/utils/dry_run.py +40 -0
  51. google_analytics_cli-0.1.0/src/ga_cli/utils/errors.py +150 -0
  52. google_analytics_cli-0.1.0/src/ga_cli/utils/output.py +209 -0
  53. google_analytics_cli-0.1.0/src/ga_cli/utils/pagination.py +93 -0
  54. google_analytics_cli-0.1.0/tests/__init__.py +0 -0
  55. google_analytics_cli-0.1.0/tests/conftest.py +24 -0
  56. google_analytics_cli-0.1.0/tests/test_access_bindings.py +520 -0
  57. google_analytics_cli-0.1.0/tests/test_access_reports.py +223 -0
  58. google_analytics_cli-0.1.0/tests/test_account_summaries.py +131 -0
  59. google_analytics_cli-0.1.0/tests/test_accounts.py +570 -0
  60. google_analytics_cli-0.1.0/tests/test_agent_cmd.py +154 -0
  61. google_analytics_cli-0.1.0/tests/test_annotations.py +491 -0
  62. google_analytics_cli-0.1.0/tests/test_api_client.py +137 -0
  63. google_analytics_cli-0.1.0/tests/test_audiences.py +508 -0
  64. google_analytics_cli-0.1.0/tests/test_auth_cmd.py +158 -0
  65. google_analytics_cli-0.1.0/tests/test_bigquery_links.py +515 -0
  66. google_analytics_cli-0.1.0/tests/test_calculated_metrics.py +551 -0
  67. google_analytics_cli-0.1.0/tests/test_channel_groups.py +496 -0
  68. google_analytics_cli-0.1.0/tests/test_completions_cmd.py +68 -0
  69. google_analytics_cli-0.1.0/tests/test_config_cmd.py +140 -0
  70. google_analytics_cli-0.1.0/tests/test_credentials.py +126 -0
  71. google_analytics_cli-0.1.0/tests/test_custom_dimensions.py +525 -0
  72. google_analytics_cli-0.1.0/tests/test_custom_metrics.py +519 -0
  73. google_analytics_cli-0.1.0/tests/test_data_retention.py +224 -0
  74. google_analytics_cli-0.1.0/tests/test_data_streams.py +465 -0
  75. google_analytics_cli-0.1.0/tests/test_describe.py +209 -0
  76. google_analytics_cli-0.1.0/tests/test_dry_run.py +723 -0
  77. google_analytics_cli-0.1.0/tests/test_errors.py +332 -0
  78. google_analytics_cli-0.1.0/tests/test_event_create_rules.py +540 -0
  79. google_analytics_cli-0.1.0/tests/test_event_edit_rules.py +612 -0
  80. google_analytics_cli-0.1.0/tests/test_firebase_links.py +248 -0
  81. google_analytics_cli-0.1.0/tests/test_google_ads_links.py +346 -0
  82. google_analytics_cli-0.1.0/tests/test_install_script.sh +35 -0
  83. google_analytics_cli-0.1.0/tests/test_key_events.py +447 -0
  84. google_analytics_cli-0.1.0/tests/test_mp_secrets.py +421 -0
  85. google_analytics_cli-0.1.0/tests/test_output.py +193 -0
  86. google_analytics_cli-0.1.0/tests/test_pagination.py +161 -0
  87. google_analytics_cli-0.1.0/tests/test_properties.py +539 -0
  88. google_analytics_cli-0.1.0/tests/test_property_settings.py +451 -0
  89. google_analytics_cli-0.1.0/tests/test_quiet_nocolor.py +148 -0
  90. google_analytics_cli-0.1.0/tests/test_reports.py +730 -0
  91. google_analytics_cli-0.1.0/tests/test_reports_batch.py +200 -0
  92. google_analytics_cli-0.1.0/tests/test_reports_funnel.py +212 -0
  93. google_analytics_cli-0.1.0/tests/test_reports_pivot.py +226 -0
  94. google_analytics_cli-0.1.0/tests/test_service_account.py +86 -0
  95. google_analytics_cli-0.1.0/tests/test_upgrade_cmd.py +230 -0
  96. google_analytics_cli-0.1.0/tests/test_version.py +31 -0
  97. google_analytics_cli-0.1.0/uv.lock +815 -0
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.12", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v5
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+
23
+ - name: Install dependencies
24
+ run: uv sync
25
+
26
+ - name: Lint
27
+ run: uv run ruff check src/ tests/
28
+
29
+ - name: Run tests
30
+ run: uv run pytest
@@ -0,0 +1,75 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - name: Install uv
13
+ uses: astral-sh/setup-uv@v5
14
+ - name: Install dependencies
15
+ run: uv sync
16
+ - name: Lint
17
+ run: uv run ruff check src/ tests/
18
+ - name: Run tests
19
+ run: uv run pytest
20
+
21
+ build:
22
+ needs: test
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v5
29
+
30
+ - name: Build
31
+ run: uv build
32
+
33
+ - name: Upload dist artifacts
34
+ uses: actions/upload-artifact@v4
35
+ with:
36
+ name: dist
37
+ path: dist/
38
+
39
+ publish-testpypi:
40
+ needs: build
41
+ runs-on: ubuntu-latest
42
+ environment: testpypi
43
+ permissions:
44
+ id-token: write
45
+ steps:
46
+ - name: Download dist artifacts
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: dist
50
+ path: dist/
51
+
52
+ - name: Install uv
53
+ uses: astral-sh/setup-uv@v5
54
+
55
+ - name: Publish to TestPyPI
56
+ run: uv publish --publish-url https://test.pypi.org/legacy/
57
+
58
+ publish-pypi:
59
+ needs: publish-testpypi
60
+ runs-on: ubuntu-latest
61
+ environment: pypi
62
+ permissions:
63
+ id-token: write
64
+ steps:
65
+ - name: Download dist artifacts
66
+ uses: actions/download-artifact@v4
67
+ with:
68
+ name: dist
69
+ path: dist/
70
+
71
+ - name: Install uv
72
+ uses: astral-sh/setup-uv@v5
73
+
74
+ - name: Publish to PyPI
75
+ run: uv publish
@@ -0,0 +1,30 @@
1
+ # OAuth credentials
2
+ client_secret.json
3
+ test-service-account.json
4
+
5
+ # Python
6
+ __pycache__/
7
+ *.py[cod]
8
+ *.egg-info/
9
+ dist/
10
+ build/
11
+ .pytest_cache/
12
+ .ruff_cache/
13
+
14
+ # Virtual environment
15
+ .venv/
16
+
17
+ # IDE
18
+ .idea/
19
+ .vscode/
20
+ *.swp
21
+
22
+ # OS
23
+ .DS_Store
24
+
25
+ # Claude
26
+ CLAUDE.md
27
+ .claude/*
28
+
29
+ # Archive
30
+ archive/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,321 @@
1
+ Metadata-Version: 2.4
2
+ Name: google-analytics-cli
3
+ Version: 0.1.0
4
+ Summary: Command-line interface for Google Analytics 4
5
+ Project-URL: Homepage, https://github.com/daidalytics/google-analytics-cli
6
+ Project-URL: Repository, https://github.com/daidalytics/google-analytics-cli
7
+ Project-URL: Issues, https://github.com/daidalytics/google-analytics-cli/issues
8
+ Author: Gunnar Griese
9
+ License: MIT
10
+ Keywords: analytics,cli,ga4,google-analytics
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Internet :: WWW/HTTP
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: click>=8.0
23
+ Requires-Dist: google-api-python-client>=2.0
24
+ Requires-Dist: google-auth-oauthlib>=1.0
25
+ Requires-Dist: google-auth>=2.0
26
+ Requires-Dist: packaging>=23.0
27
+ Requires-Dist: platformdirs>=4.0
28
+ Requires-Dist: questionary>=2.0
29
+ Requires-Dist: rich>=13.0
30
+ Requires-Dist: shellingham>=1.3.0
31
+ Requires-Dist: typer>=0.9.0
32
+ Description-Content-Type: text/markdown
33
+
34
+ # GA CLI
35
+
36
+ Command-line interface for Google Analytics 4.
37
+
38
+ Manage GA4 accounts, properties, data streams, and run reports — all from your terminal.
39
+
40
+ ## Features
41
+
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
+
78
+ - **Flexible output** — Table (default), JSON, and compact output formats
79
+ - **Shell completions** — Generate completion scripts for bash, zsh, and fish
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`
89
+
90
+ ## Installation
91
+
92
+ ### From PyPI (recommended)
93
+
94
+ ```bash
95
+ # pipx (recommended for CLI tools — isolated env)
96
+ pipx install google-analytics-cli
97
+
98
+ # uv
99
+ uv tool install google-analytics-cli
100
+
101
+ # pip
102
+ pip install google-analytics-cli
103
+ ```
104
+
105
+ ### Quick install (script)
106
+
107
+ ```bash
108
+ curl -fsSL https://raw.githubusercontent.com/daidalytics/google-analytics-cli/master/install.sh | bash
109
+ ```
110
+
111
+ ### From GitHub
112
+
113
+ ```bash
114
+ # With uv
115
+ uv pip install git+https://github.com/daidalytics/google-analytics-cli.git
116
+
117
+ # With pip
118
+ pip install git+https://github.com/daidalytics/google-analytics-cli.git
119
+ ```
120
+
121
+ ### From source
122
+
123
+ ```bash
124
+ git clone https://github.com/daidalytics/google-analytics-cli.git
125
+ cd google-analytics-cli
126
+ uv sync
127
+ uv run ga --help
128
+ ```
129
+
130
+ ### One-off execution (no install)
131
+
132
+ ```bash
133
+ uvx --from git+https://github.com/daidalytics/google-analytics-cli.git ga --help
134
+ ```
135
+
136
+ ## Quick Start
137
+
138
+ ```bash
139
+ # 1. Authenticate
140
+ ga auth login
141
+
142
+ # 2. List your accounts
143
+ ga accounts list
144
+
145
+ # 3. List properties for an account
146
+ ga properties list --account-id 123456789
147
+
148
+ # 4. Run a report
149
+ ga reports run --property-id 987654321 \
150
+ --metrics sessions,totalUsers \
151
+ --dimensions date \
152
+ --start-date 7daysAgo
153
+ ```
154
+
155
+ ## Setup
156
+
157
+ ### 1. Create OAuth credentials
158
+
159
+ Create an OAuth 2.0 Client ID in the [Google Cloud Console](https://console.cloud.google.com/apis/credentials):
160
+
161
+ 1. Go to **APIs & Services > Credentials**
162
+ 2. Click **Create Credentials > OAuth client ID**
163
+ 3. Choose **Desktop app** as the application type
164
+ 4. Download the JSON file
165
+
166
+ Make sure the following APIs are enabled in your GCP project:
167
+ - Google Analytics Admin API
168
+ - Google Analytics Data API
169
+
170
+ ### 2. Configure client credentials
171
+
172
+ Copy the downloaded `client_secret.json` to the GA CLI config directory:
173
+
174
+ ```bash
175
+ mkdir -p ~/.config/ga-cli
176
+ cp /path/to/client_secret.json ~/.config/ga-cli/client_secret.json
177
+ ```
178
+
179
+ Alternatively, set environment variables:
180
+
181
+ ```bash
182
+ export GA_CLI_CLIENT_ID="your-client-id"
183
+ export GA_CLI_CLIENT_SECRET="your-client-secret"
184
+ ```
185
+
186
+ ### 3. Authenticate
187
+
188
+ ```bash
189
+ ga auth login
190
+ ```
191
+
192
+ This opens your browser for Google OAuth consent and stores the token locally at `~/.config/ga-cli/credentials.json`.
193
+
194
+ #### Service account (alternative)
195
+
196
+ ```bash
197
+ ga auth login --service-account /path/to/key.json
198
+ ```
199
+
200
+ Or set an environment variable:
201
+
202
+ ```bash
203
+ export GA_CLI_SERVICE_ACCOUNT="/path/to/key.json"
204
+ ```
205
+
206
+ ## Command Reference
207
+
208
+ | Command | Subcommands | Description |
209
+ |---------|-------------|-------------|
210
+ | `ga auth` | `setup`, `login`, `logout`, `status` | Manage authentication |
211
+ | `ga config` | `setup`, `get`, `set`, `unset`, `path`, `reset` | Manage CLI configuration |
212
+ | `ga accounts` | `list`, `get`, `update`, `delete`, `get-data-sharing`, `change-history` | Manage GA4 accounts |
213
+ | `ga account-summaries` | `list` | Quick overview of all accounts and properties |
214
+ | `ga properties` | `list`, `get`, `create`, `update`, `delete`, `acknowledge-udc`, `quotas` | Manage GA4 properties |
215
+ | `ga custom-dimensions` | `list`, `get`, `create`, `update`, `archive` | Manage custom dimensions |
216
+ | `ga custom-metrics` | `list`, `get`, `create`, `update`, `archive` | Manage custom metrics |
217
+ | `ga calculated-metrics` | `list`, `get`, `create`, `update`, `delete` | Manage calculated metrics |
218
+ | `ga data-streams` | `list`, `get`, `create`, `update`, `delete` | Manage data streams |
219
+ | `ga key-events` | `list`, `get`, `create`, `update`, `delete` | Manage key events (conversions) |
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 |
235
+ | `ga upgrade` | `--check`, `--force` | Check for and install updates |
236
+ | `ga completions` | `bash`, `zsh`, `fish` | Generate shell completion scripts |
237
+
238
+ Use `ga <command> --help` for detailed usage of any command, or `ga --describe` for the full CLI schema as JSON.
239
+
240
+ ### Output formats
241
+
242
+ All read commands support `--output` (`-o`) to control output format:
243
+
244
+ ```bash
245
+ ga accounts list --output json # JSON output
246
+ ga accounts list --output table # Table output (default)
247
+ ga accounts list --output compact # Minimal ID + name output
248
+ ```
249
+
250
+ ## Global Options
251
+
252
+ ```
253
+ --help, -h Show help
254
+ --version, -v Show version
255
+ --quiet, -q Suppress non-essential output
256
+ --no-color Disable colored output
257
+ --describe Show full CLI schema as JSON (for agents and tooling)
258
+ ```
259
+
260
+ ## Shell Completions
261
+
262
+ ```bash
263
+ ga completions bash > ~/.bash_completion.d/ga
264
+ ga completions zsh > ~/.zsh/completions/_ga
265
+ ga completions fish > ~/.config/fish/completions/ga.fish
266
+ ```
267
+
268
+ ## Environment Variables
269
+
270
+ | Variable | Description |
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) |
274
+ | `GA_CLI_SERVICE_ACCOUNT` | Path to service account key file |
275
+ | `GOOGLE_APPLICATION_CREDENTIALS` | Standard GCP credential path (fallback) |
276
+ | `GA_CLI_CONFIG_DIR` | Override config directory |
277
+ | `NO_COLOR` | Disable colored output |
278
+
279
+ ## CI/CD Integration
280
+
281
+ ```yaml
282
+ jobs:
283
+ ga-report:
284
+ runs-on: ubuntu-latest
285
+ steps:
286
+ - name: Install GA CLI
287
+ run: pip install google-analytics-cli
288
+
289
+ - name: Export daily report
290
+ run: |
291
+ echo '${{ secrets.GA_SERVICE_ACCOUNT_KEY }}' > /tmp/sa-key.json
292
+ ga auth login --service-account /tmp/sa-key.json
293
+ ga reports run -p ${{ vars.GA_PROPERTY_ID }} \
294
+ --metrics sessions,users --dimensions date \
295
+ --start-date 7daysAgo -o json > report.json
296
+ rm /tmp/sa-key.json
297
+ ```
298
+
299
+ ## Privacy
300
+
301
+ GA CLI stores authentication credentials locally on your machine. No data is sent to any third party — all communication is directly between your machine and Google's APIs.
302
+
303
+ ## Development
304
+
305
+ ```bash
306
+ # Install with dev dependencies
307
+ uv sync
308
+
309
+ # Run the CLI
310
+ uv run ga --help
311
+
312
+ # Run tests
313
+ uv run pytest
314
+
315
+ # Lint
316
+ uv run ruff check src/ tests/
317
+ ```
318
+
319
+ ## License
320
+
321
+ MIT