{"schemaVersion":1,"resourceType":"connector","slug":"google-analytics","name":"Google Analytics","catalog":"ga4","description":"Read Google Analytics 4 reports, realtime activity and property settings as tables","language":"Python","categories":["business","google"],"repository":"https://github.com/Query-farm/vgi-google-analytics","license":"MIT","generatedAt":"2026-12-01T18:22:16+00:00","runtime":{"engineVersion":"2.0.1","protocolVersion":"3.4"},"release":{"tag":"v0.2.1","publishedAt":"2026-11-29T20:40:49Z","url":"https://github.com/Query-farm/vgi-google-analytics/releases/tag/v0.2.1"},"links":{"html":"https://query.farm/products/orchard/connectors/google-analytics/","llms":"https://query.farm/products/orchard/connectors/google-analytics/llms.txt","markdown":"https://query.farm/products/orchard/connectors/google-analytics/index.md","json":"https://query.farm/products/orchard/api/v1/connectors/google-analytics.json","objects":"https://query.farm/products/orchard/api/v1/connectors/google-analytics/objects.json","search":"https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=google-analytics&q={query}"},"authentication":{"mode":"required","guidance":"Supply your own service credentials or required connection options before querying protected data.","interpretation":"Secret parameter required flags describe the upstream declaration; they do not override the service-level mode above. Keep secrets in environment variables or the deployment secret store. SQL values in angle brackets are placeholders, not automatic environment lookups. Native DuckDB and Haybarn 2.0.1 do not provide a SQL getenv() function, even when worker-supplied snippets mention it. Read environment variables in your application and pass credential values through client parameter bindings (for example, Python con.execute(\"CREATE SECRET stripe (TYPE stripe, api_key ?)\", [os.environ[\"STRIPE_API_KEY\"]]) after attaching the connector. Omit unused optional parameters and keep real values out of saved SQL and logs.","secrets":[{"type":"google_analytics","description":"Google Analytics credentials (scope analytics.readonly). Provide ONE of: service_account_json (a service-account key, the account added to the GA4 property as a Viewer); client_id + client_secret + refresh_token (an OAuth user grant); or access_token (short-lived). quota_project_id optionally bills API quota to a specific Google Cloud project.","documentation":"https://github.com/Query-farm/vgi-google-analytics#supplying-credentials-with-a-duckdb-secret","parameters":[{"name":"service_account_json","type":"VARCHAR","required":false,"redact":true,"description":"Contents of a service-account JSON key file."},{"name":"client_id","type":"VARCHAR","required":false,"redact":false,"description":"OAuth client id of a user grant."},{"name":"client_secret","type":"VARCHAR","required":false,"redact":true,"description":"OAuth client secret of a user grant."},{"name":"refresh_token","type":"VARCHAR","required":false,"redact":true,"description":"OAuth refresh token granting analytics.readonly."},{"name":"access_token","type":"VARCHAR","required":false,"redact":true,"description":"Short-lived OAuth access token (about an hour)."},{"name":"quota_project_id","type":"VARCHAR","required":false,"redact":false,"description":"Google Cloud project to bill API quota to (optional)."}],"requiredBy":["all_account_summaries","all_accounts","all_properties","data_streams","custom_dimensions","custom_metrics","key_events","dimensions","metrics","check_compatibility","property_quota","report","realtime_report"],"createSql":"CREATE SECRET google_analytics (\n    TYPE google_analytics,\n    service_account_json '<GOOGLE_ANALYTICS_SERVICE_ACCOUNT_JSON>',  -- secret\n    client_id            '<client_id>',\n    client_secret        '<GOOGLE_ANALYTICS_CLIENT_SECRET>',  -- secret\n    refresh_token        '<REFRESH_TOKEN>',  -- secret\n    access_token         '<ACCESS_TOKEN>',  -- secret\n    quota_project_id     '<quota_project_id>'\n);"}]},"deployment":{"local":{"methods":[{"id":"uvx","label":"uvx","icon":"simple-icons:python","steps":[{"title":"Attach with uvx","description":"Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.","lang":"sql","code":"ATTACH 'ga4' AS ga4 (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-google-analytics@v0.2.1 vgi-google-analytics'\n);"}]},{"id":"docker","label":"Docker","icon":"simple-icons:docker","steps":[{"title":"Attach the signed image","description":"Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.","lang":"sql","code":"ATTACH 'ga4' AS ga4 (\n  TYPE vgi,\n  LOCATION 'oci://ghcr.io/query-farm/vgi-google-analytics:0.2.1'\n);"}]}],"pinnedMethods":[{"id":"uvx","label":"uvx","icon":"simple-icons:python","steps":[{"title":"Attach with uvx","description":"Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.","lang":"sql","code":"ATTACH 'ga4' AS ga4 (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-google-analytics@v0.2.1 vgi-google-analytics'\n);"}]},{"id":"docker","label":"Docker","icon":"simple-icons:docker","steps":[{"title":"Attach the signed image","description":"Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.","lang":"sql","code":"ATTACH 'ga4' AS ga4 (\n  TYPE vgi,\n  LOCATION 'oci://ghcr.io/query-farm/vgi-google-analytics:0.2.1'\n);"}]}]},"selfHost":{"instructions":"https://github.com/Query-farm/vgi-google-analytics","connectionGuide":"https://query.farm/vgi/connect-to-a-worker/","guidance":"Deploy using the connector repository instructions and use its supported HTTP or SSH transport. Replace example URLs with your actual deployment; configure its authentication."},"queryFarm":{"available":true,"console":"https://auth.queryfarm.cloud/console/new?worker=google-analytics","organizationMonthlyMinimumUsd":10,"pricing":"https://query.farm/products/orchard/hosted/"},"publicDemo":null},"setup":{"extensions":{"duckdb":"SET allow_extension_repositories = 'allowed';\n\nCREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm\n    WITH PREFIX 'https://duckdb-extensions.query.farm';\n\nINSTALL vgi FROM query_farm;\nLOAD vgi FROM query_farm;","haybarn":"INSTALL vgi FROM community;\nLOAD vgi;"},"attachSql":"ATTACH 'ga4' AS ga4 (\n  TYPE vgi,\n  LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-google-analytics@v0.2.1 vgi-google-analytics'\n);","attachOptions":[{"name":"credentials","type":"VARCHAR","description":"Where credentials come from: 'auto' (default) uses the google_analytics secret and otherwise Application Default Credentials where the worker permits it; 'secret' requires the secret and never falls back; 'oauth' signs in locally through the browser to Query Farm's app and carries refreshable credentials in the client's opaque attach data.","required":false,"default":"auto"},{"name":"report_page_size","type":"BIGINT","description":"Rows fetched per report() API request, up to 250000 (default 100000).","required":false,"default":"100000"},{"name":"data_api_url","type":"VARCHAR","description":"Base URL of the GA4 Data API, for a proxy or a test double. Overriding it disables the Application Default Credentials fallback.","required":false,"default":"https://analyticsdata.googleapis.com/v1beta"},{"name":"admin_api_url","type":"VARCHAR","description":"Base URL of the GA4 Admin API, for a proxy or a test double. Overriding it disables the Application Default Credentials fallback.","required":false,"default":"https://analyticsadmin.googleapis.com/v1beta"}],"note":"Install and load VGI, attach the connector using the catalog alias shown here, then create required secrets. Replace placeholders and omit unused optional secret parameters. Satisfy file, network and credential prerequisites before executing a query."},"example":{"title":"Track daily active users and sessions","sql":"SELECT property_id, date, activeUsers, sessions FROM ga4.main.report('', dimensions => ['date'], metrics => ['activeUsers', 'sessions']) ORDER BY property_id, date","requiresCredentials":true,"note":null,"objects":[{"name":"ga4.main.report","kind":"table_function","links":{"html":"https://query.farm/products/orchard/connectors/google-analytics/#obj-main-report","markdown":"https://query.farm/products/orchard/connectors/google-analytics/objects/table_function.bWFpbg.cmVwb3J0.md","json":"https://query.farm/products/orchard/api/v1/connectors/google-analytics/objects/table_function.bWFpbg.cmVwb3J0.json"}}],"evidence":{"status":"not_captured","note":"No executed result is recorded for this exact example. Catalog verification does not establish that this query ran."},"artifact":null},"objects":{"total":16,"index":"https://query.farm/products/orchard/api/v1/connectors/google-analytics/objects.json","search":"https://query.farm/products/orchard/api/v1/search.json?kind=object&connector=google-analytics&q={query}"},"agentTasks":["Which Google Analytics properties can I query? Give their ids and names.","How many active users did my first GA4 property have on each of the last 7 days?","How many distinct users visited my first GA4 property in the last 28 days?","Which marketing channels drove the most sessions to my first property last month?","In my first property, how many purchase events came from each country in the last 28 days?","What is the GA4 api name for the landing page dimension?","How many people are on my first property's site or app right now?","What custom dimensions does my first property have, and how do I use them in a report?"],"provenance":{"generatedAt":"2026-12-01T18:22:16+00:00","repository":"https://github.com/Query-farm/vgi-google-analytics","harvest":{"status":"ok","method":"subprocess","error":null,"vgi_version":"9773130dde"},"catalogVerification":{"verified":true,"status":"passed_with_credential_skips","total":5,"passed":0,"failed":0,"needs_credentials":5,"location":"uvx --from git+https://github.com/Query-farm/vgi-google-analytics@v0.2.1 vgi-google-analytics","transport":"subprocess","environment":{"vgi_extension_version":"9773130dde","haybarn_version":"2.0.1rc3","engine_version":"v2.0.1","python":"3.12.4","platform":"darwin_arm64","protocol_version":"3.4.0"},"checked_at":"2026-12-01T06:13:23+00:00"},"interpretation":"Catalog verification records the harvest environment. It is not proof that every query or current live API call succeeds. Only an example with captured_result has a saved result for that exact SQL."},"interpretation":["Missing, null, or undeclared metadata means unknown; do not invent defaults, credential scope, platform support or endpoint URLs.","Search is keyword retrieval, not proof of a capability. Read the exact object declaration before generating SQL.","A table and a table function can have the same name. Preserve parentheses and use the matching overload and schema.","Service credentials, external data availability and deployment authentication are separate requirements."]}