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`.
|
||||
|
||||
@@ -25,6 +25,16 @@ injects the session — callers never handle the session.
|
||||
| `X-Sklik-Token` | yes | API token from Sklik → account settings → API. |
|
||||
| `X-Sklik-User-Id` | no | Managed account `userId` (agency/MCC access). |
|
||||
|
||||
### Kde získat token (návod pro klienta)
|
||||
|
||||
1. Přihlaste se na [sklik.cz](https://www.sklik.cz/).
|
||||
2. Vpravo nahoře **uživatelské jméno → Nastavení**.
|
||||
3. Sekce **Přístup k API Drak** → **Zobrazit token**.
|
||||
4. Token → hlavička `X-Sklik-Token`.
|
||||
|
||||
> Nový token zneplatní ten předchozí. Token je vázaný na účet, pod kterým jste
|
||||
> přihlášeni. Pro správu cizích účtů (agentura/MCC) použijte `X-Sklik-User-Id`.
|
||||
|
||||
Missing token → `401 missing_credentials`. Sklik business errors (invalid token,
|
||||
access denied, bad arguments) are surfaced as `upstream_error` with the Sklik
|
||||
`status` and full body.
|
||||
|
||||
Reference in New Issue
Block a user