navod
This commit is contained in:
@@ -23,6 +23,30 @@ The service account (or token) must have access to the GA4 property — add its
|
||||
> `[Convert]::ToBase64String([IO.File]::ReadAllBytes("service-account.json"))`
|
||||
> (PowerShell).
|
||||
|
||||
## Kde získat údaje (návod pro klienta)
|
||||
|
||||
**ID property** (`property_id` v URL): GA4 → **Administrace → Nastavení
|
||||
property** → *ID property* (např. `123456789`).
|
||||
|
||||
**A) Service account – doporučeno (`X-GA-Credentials`)**
|
||||
|
||||
1. [Google Cloud Console](https://console.cloud.google.com/) → projekt.
|
||||
2. **APIs & Services → Library** → povolit **Google Analytics Data API** a
|
||||
**Google Analytics Admin API**.
|
||||
3. **IAM & Admin → Service Accounts → Create service account**.
|
||||
4. U účtu **Keys → Add key → JSON** → stáhne se klíč.
|
||||
5. `client_email` z JSON přidat v GA4 **Administrace → Správa přístupu k
|
||||
property** jako **Viewer**.
|
||||
6. JSON zakódovat do base64 (viz výše) → hlavička `X-GA-Credentials`.
|
||||
|
||||
**B) Hotový OAuth2 token – rychlý test (`X-GA-Access-Token`)**
|
||||
|
||||
1. [OAuth 2.0 Playground](https://developers.google.com/oauthplayground/).
|
||||
2. Scope `https://www.googleapis.com/auth/analytics.readonly` → **Authorize
|
||||
APIs** (Google účet s přístupem k property).
|
||||
3. **Exchange authorization code for tokens** → *Access token* → hlavička
|
||||
`X-GA-Access-Token` (platí ~1 h).
|
||||
|
||||
## Data API endpoints
|
||||
|
||||
`property_id` may be the bare number (`123456789`) or `properties/123456789`.
|
||||
|
||||
Reference in New Issue
Block a user