Your data / PREVIEW
Connect Search Console and GA4
Read your own Google properties with read-only credentials. Google integrations are preview features in GWG SEO 0.1.0.
Preview status
Bring a Google Desktop OAuth client
- Enable the Search Console API and Google Analytics Data API in your own Google Cloud project.
- Configure the OAuth consent setup, including test users when applicable, and create a Desktop OAuth client. Download its client JSON outside your repository.
- Use a Google identity that already has access to the Search Console or GA4 property you need.
npx --no-install gwg-seo auth login \
--client /absolute/path/to/desktop-client.json
npx --no-install gwg-seo auth status
npx --no-install gwg-seo reports run google.sitesLogin uses the browser, PKCE, state validation, and a temporary loopback callback. auth status reports locally present credentials; it does not verify property access. Google’s installed-app OAuth guide describes the credential type.
Request Search Console rows
npx --no-install gwg-seo reports run google.search \
--site sc-domain:example.com \
--start-date 2026-09-01 --end-date 2026-09-30 \
--dimensions query,page --max-rows 1000Replace the property and dates. Use the exact property identifier returned by google.sites: a domain property such as sc-domain:example.com or an authorized URL-prefix property. The report accepts query, page, date, country, and device dimensions.
Search Console can omit anonymized queries and return top rows rather than every row. Recent dates can be incomplete. See Google’s Search Analytics API reference.
Request GA4 organic landing pages
npx --no-install gwg-seo reports run google.analytics \
--property 123456789 \
--start-date 2026-09-01 --end-date 2026-09-30 --max-rows 1000Use your numeric GA4 property ID. The report reads organic-search landing pages, sessions, engaged sessions, and key events. Check returned coverage and metadata for limitations such as thresholding. Search Console clicks and GA4 sessions measure different events and will not necessarily match. See the GA4 Data API reference.
Prioritize a bounded set of search rows
npx --no-install gwg-seo reports run search.opportunities \
--params '{"site":"sc-domain:example.com","startDate":"2026-09-01","endDate":"2026-09-30","minImpressions":100}'This prioritizes rows with average positions 4 through 20 and a minimum impression threshold. It inherits the Search Console report’s coverage limits. The result is a review queue, not a traffic forecast.
Unattended credentials and logout
For a service account, provide its credential file using GOOGLE_APPLICATION_CREDENTIALS and grant that identity access to the relevant properties. A temporary GWG_GOOGLE_ACCESS_TOKEN is also supported. Keep credentials out of source control and client-side code.
Credential precedence is an explicit library token, environment token, saved OAuth, then a service-account file. There is no metadata-server credential discovery. auth logout removes local saved OAuth state; it does not revoke the Google grant or remove environment credentials. See privacy and local state.
