Connect

Get Google Analytics OAuth connect URL

Changed on

Starts OAuth for Google Analytics (GA4). Each connected GA4 property becomes its own account with platform googleanalytics; it reads reports and does not post.

Requested scope: https://www.googleapis.com/auth/analytics.readonly.

Flow

Redirect the user to authUrl.

  • One readable property: Zernio connects it and redirects to redirect_url (or the dashboard) with connected=googleanalytics, profileId, accountId and username (the property name).
  • Several properties: the user first picks one on a Zernio-hosted page, which then redirects the same way.

Your own property picker

Add headless=true to redirect_url. Zernio then redirects there with step=select_property, profileId, platform=googleanalytics and a pendingDataToken for GET /v1/connect/googleanalytics/properties and POST /v1/connect/googleanalytics/select-property.

Errors

On failure the redirect carries error, platform=googleanalytics and error_message. Errors include:

  • googleanalytics_scope_missing: the user unticked Analytics access.
  • googleanalytics_no_properties
get/v1/connect/googleanalytics

Request

  • Base URL
    https://zernio.com/api
  • URL
    https://zernio.com/api/v1/connect/googleanalytics
  • Auth
    • HTTP bearer
    • or API key in header X-Connect-Token

Query parameters

profileIdstring required

Your Zernio profile ID (get from /v1/profiles).

redirect_urlstring

Custom redirect after connection. Must be an absolute http(s) URL or custom app scheme such as myapp://callback; relative and unsafe URLs return 400.

reconnectAccountIdstring

Zernio account ID of the Google Analytics account being reconnected. Picking a different property then fails instead of adding a second account.

Response

OAuth authorization URL and authenticated state

authUrlstring uri required

Google URL to open in the user agent.

statestring required

Authenticated, expiring OAuth state handled by the callback.

Changes