DOCS › SELF-HOST › GOOGLE SERVICE ACCOUNT

Google service account

The self-hosted desk reads Search Console and GA4 with your own service account, read-only. No OAuth app, and no Google keys stored by Morningdesk.

SELF-HOST · READ-ONLY SCOPES

The desk reads Search Console (rankings) and, optionally, GA4 (AI referral visits and conversions per page) with read-only scopes:

  • https://www.googleapis.com/auth/webmasters.readonly
  • https://www.googleapis.com/auth/analytics.readonly

There is no OAuth app and no Google verification. You create a service account in your own Google Cloud project, give the desk a way to act as it, and add the service account's email to your Search Console property and GA4 property. Morningdesk never stores Google keys: it uses Google's own library (google-auth-library) and its Application Default Credentials (ADC).

1. Create the reader service account

In a Google Cloud project you control:

terminal
gcloud iam service-accounts create morningdesk-reader --display-name "Morningdesk reader"
gcloud services enable searchconsole.googleapis.com analyticsadmin.googleapis.com analyticsdata.googleapis.com

The email looks like morningdesk-reader@PROJECT_ID.iam.gserviceaccount.com. It needs no IAM roles in the project: its access comes from Search Console and GA4 (step 3).

The Search Console API, the Google Analytics Admin API (to list GA4 properties and their key events) and the Google Analytics Data API (to read referrals and conversion counts) must be enabled in the project whose credentials the desk uses. "Check access" names the API when it isn't.

2. Let the desk act as it (pick one)

Ordered from best to last resort. Domain-wide delegation is never needed; leave it off.

a. On Google Cloud (Cloud Run, GCE, GKE): attached service account

Run the desk with morningdesk-reader as its service account. ADC finds it through the metadata server. No keys, no variables.

If the desk already runs as another service account, keep it and impersonate the reader instead:

terminal
gcloud iam service-accounts add-iam-policy-binding morningdesk-reader@PROJECT_ID.iam.gserviceaccount.com \
  --member "serviceAccount:RUNTIME_SA_EMAIL" --role roles/iam.serviceAccountTokenCreator

and set:

terminal
MORNINGDESK_GOOGLE_IMPERSONATE=morningdesk-reader@PROJECT_ID.iam.gserviceaccount.com

b. Off Google Cloud: Workload Identity Federation, impersonating the reader

For GitHub Actions, AWS, Azure or any OIDC/SAML identity provider. Search Console and GA4 grant access to an email address, and a federated identity has none, so it must impersonate the reader service account (not "direct resource access").

  1. Create a workload identity pool and provider for your platform (Google Cloud console › IAM › Workload Identity Federation).
  2. Let the federated principal impersonate the reader: grant it roles/iam.workloadIdentityUser on morningdesk-reader.
  3. Download the credential configuration file (it holds no secret key) and point ADC at it:
terminal
GOOGLE_APPLICATION_CREDENTIALS=/run/secrets/google-wif.json

The configuration names the service account to impersonate. You can also leave impersonation out of the file and set MORNINGDESK_GOOGLE_IMPERSONATE instead (the federated principal then needs roles/iam.serviceAccountTokenCreator on the reader).

c. A developer machine: gcloud ADC with impersonation

terminal
gcloud auth application-default login \
  --impersonate-service-account morningdesk-reader@PROJECT_ID.iam.gserviceaccount.com

Your own Google account needs Token Creator on the reader.

d. Last resort: a service account key file

Keys are long-lived secrets; prefer a, b or c. If you must:

terminal
gcloud iam service-accounts keys create /run/secrets/google.json \
  --iam-account morningdesk-reader@PROJECT_ID.iam.gserviceaccount.com
chmod 600 /run/secrets/google.json
GOOGLE_APPLICATION_CREDENTIALS=/run/secrets/google.json

Mount the file read-only, keep it out of backups you share, and rotate it.

Restart the desk after changing credentials. Settings › Connections and onboarding show the service account email the desk found; "This desk has no Google credentials" means ADC found nothing.

3. Add the email in Search Console and GA4

Search Console (needs an Owner of the property): Open the property for your site › Settings › Users and permissions › Add user. Paste the service account email and choose Restricted. A domain property (sc-domain:example.com) or a URL-prefix property (https://www.example.com/) both work; the desk prefers the domain property when it sees both. The same user also lets the desk read each changed page's index status (see Google index status); Google doesn't document which role that needs for a service account, so if pages say "No index status", follow that section.

GA4 (optional, for AI referral visits and conversions per page; needs an Administrator): Admin › Property access management › Add users. Paste the email and choose Viewer at property level. The desk matches a GA4 property to the site by its web stream URL; you can pick another property after checking access.

Google can take a minute to apply a new user.

4. Check access

In onboarding (step 3) or Settings › Connections, press Check access. The desk tests Search Console and GA4 separately:

Each side shows one of five states:

State Search Console GA4
Connected One property matches the site. The desk starts pulling 16 months of history in the background. One property has a web stream for the site. AI referral visits start, and conversions per page once the property has a key event.
Several More than one property matches (a domain property and a URL-prefix one). The desk picks one; you can change it. More than one property has a web stream for the site. The desk picks one; you can change it.
No access The email isn't on the property yet (or only as unverified). Add it as Restricted. The email can't see a property for the site. Add it as Viewer, or go on without AI referral visits and conversions per page.
No credentials The server has no Google credentials at all. Finish step 2, restart, and check again. Same.
Error Google refused the call. Usually the API isn't enabled in your project, or (with impersonation) the desk's identity lacks Token Creator on the reader. Same, for the Analytics Admin API.

Settings › Connections then lists Search Console and GA4 as two lines under Google, each Connected, Needs attention or Not connected.

Changing the Search Console property later only accepts a property the service account can see for this site. If the desk already stored data from the old property, it asks you to confirm first: the stored days are deleted and 16 months load again from the new one.

Google core updates

When Google rolls out a core update, rankings move across many sites at once, and a page can slip and then come back on its own. The desk keeps a list of Google's confirmed core updates (from Google's own announcements). If a page slipped during one, Slipping says so in "Why it slipped", and Today leaves that page out while the update rolls out and for 14 days after it ends, so you don't rewrite a page that may recover. "Checked for today's edition" counts those pages with a link to Slipping. Each held page is counted once, in the first row that fits: Barely visible, then fewer searches (Demand fell), then the core update, then a page you changed that Google is still measuring. The writer doesn't treat them as a reason to rewrite either. This needs no extra Google access: it compares the dates of your stored Search Console data with the update's dates.

Key events

SEO and Articles show conversions per page: how many times the site's conversion event happened in visits that started on that page (GA4's session landing page, so the same visit), over the last 28 days. The conversion event is one of your GA4 property's key events. The desk reads them with the same read-only GA4 access; there is no new scope and nothing to add to the service account.

To mark a key event in GA4 (needs an Editor or Administrator of the property): open Admin › Key events (under Data display), choose New key event, and enter the event name exactly as your site sends it, for example sign_up or purchase. You can also open Admin › Events and turn on Mark as key event for an event GA4 has already seen. Then press Check again in Settings › Connections, on the GA4 line.

Which event counts:

  • Settings › Connections › GA4 › Counts as a conversion lists the property's key events with their counts for the last 28 days. The default is the first of sign_up, purchase and generate_lead the property has, else the key event with the most events. Pick another, or Don't measure.
  • Saving a different event reads the last 90 days again at once. After that the desk reads once a day (the last 30 days are replaced, because GA4 revises recent days) and the key-event list (with each key event's site-wide count for the last 28 days, for the picker) every 7 days.
  • A page with fewer than 30 visits shows its counts but no rate. A rate counts events, not visits, so a page where some visits convert twice can rarely read above 100%.
  • When a read fails, the last counts stay, greyed, with the day they cover, for 7 days. After that the page says "Not measured: GA4 read failed" until a read works again.
  • Without GA4, without a key event, or with Don't measure, every page says Not measured and why, never 0.

What the desk reads and keeps: per landing page path (no query string) and day, the number of visits and the number of key events. No user, client or session ids. Rows are kept for 90 days, and removing Google from the site deletes them. Conversions are never used as facts or proof in drafts, and the writer never sends them to the AI model.

Removing access

Deleting a site or the Google connection in Morningdesk stops the desk from reading, but it can't remove the service account from Search Console or GA4 for you. Remove the user there if you want its access gone.

Google index status (URL Inspection)

Before the desk suggests changing a page, it checks whether Google has seen your last change. It asks Search Console's URL Inspection API (POST https://searchconsole.googleapis.com/v1/urlInspection/index:inspect) for the page's index status: whether Google indexed it (and Google's own words when it didn't), when Google last crawled it, which crawler, and which URL Google treats as the main version. This uses the same read-only access (webmasters.readonly): there is no new scope and nothing to add to the service account if Search Analytics already works. It costs nothing.

Which pages it asks about. Never every page. Only:

  • pages you changed (a Morningdesk publish, a change the readiness check saw in the page's main text, or a date you marked with I changed this page in the page drawer) until Google has crawled them, once a day;
  • changed pages Google has already crawled, and pages listed on Slipping, about once a week;
  • a page you open in the drawer when the stored answer is older than 7 days. Check again in the drawer asks right away, at most once an hour per page.

Unchanged pages that aren't slipping are never asked about.

Limits. Google allows 2,000 inspections a day and 600 a minute per Search Console property, shared with any other tool you use on it. The desk uses at most 200 a day and 30 a minute per site, so most of the quota stays yours. When the desk's share is used up, or Google answers 429, it stops for that site until the next day (Pacific time) and shows the last stored answer with its date.

Rewrite cooldown. After a change, a page is on hold until Google has crawled it after the change and 28 days of Search Console data have come in since that crawl (plus the usual 2-day delay in Search Console data), so the result of the change can be read before anything else changes. While a page is on hold it stays off Today (counted in "Checked for today's edition"), Slipping says "Google hasn't seen your change" or "Measuring your change", Write about this on that page is locked with the date it opens, the writer doesn't propose on it, and MCP propose_article refuses with the date. When the crawl date is unknown (no Search Console, no access, today's checks used up, or Google never crawled the page) the desk assumes Google crawls within 14 days of the change and marks the date as estimated. Only changes in the last 120 days count. The rule is the same for every site.

Barely visible. A slipping page whose position was worse than 20 (page 3 or lower) with at most 2 clicks in the baseline, or whose clicks held while at least 80% of the impressions it lost came from queries ranked worse than 20, is marked Barely visible: nothing real was lost. It stays on Slipping, last and muted, never reaches Today, and doesn't count toward a site-wide drop.

No index status. If Google answers 403 for URL Inspection, the drawer shows "No index status" and the desk stops asking for that site until the next day. It never marks the Google connection as needing attention, because rankings may still work with the same user. Check the service account is a user on the property (step 3); if it is listed as Restricted and URL Inspection still answers 403, change it to Full.

What the desk keeps. Only the latest answer per page: when it asked, the last crawl time, Google's verdict, coverage, indexing, fetch and robots.txt states, which crawler, and the two canonical URLs, as Google wrote them. Removing Google from the site deletes them. The change history keeps a hash of each page's main text, never the text.