Retrieve marketing data with an AI agent: GSC, GA4, and Google Ads

An AI agent can retrieve marketing data from Google Search Console, Google Analytics 4, and Google Ads without repeated manual exports. The setup matters more than the prompt: give the agent access to the right property, restrict it to reporting, and check what it actually returns. This guide shows how to connect Hermes through a service account, where each Google product differs, and how to turn a report into a decision you can review.

Marketing data from Search Console, GA4, and Google Ads flowing into an AI agent
Separate data sources, one reporting workflow. Each source still needs its own access setup.

The Search Console example comes from our own Hermes installation at Voltti. It is a historical report reproduced from the Dutch article, not a new measurement. We do not present GA4 or Google Ads as tested Voltti integrations here. If you still need the agent itself, see our Hermes desktop and terminal installation guide or the official Hermes website.

Create a service account in Google Cloud

A service account is an identity for software rather than a person. It does not gain access to your marketing accounts simply because you created it in Google Cloud. You must enable the relevant API and grant access inside each Google product. A Cloud IAM role, a product role, and an OAuth scope do different jobs; none replaces the others.

You can ask Hermes to prepare the connection in your existing workspace. A separate Hermes profile is not required for this task. Keep the request short and start with one source:

Install gcloud and connect Google Search Console for [MY_WEBSITE] using a service account. Add its email in GSC through browser control, or give me the email to add myself. Use read-only access, ask me to approve permissions, and test the connection.

Hermes can inspect the setup, prepare commands, and use an available browser to help with configuration. You handle Google sign-in, 2FA, and consent, and approve the project, property, and access changes. Never give the agent your password or ask it to bypass a login check. Browser access does not remove these human steps. Review the result rather than assuming the setup succeeded.

For a manual setup, or to review what the agent proposes, use these steps:

  • Select an existing Google Cloud project or create one you are authorized to use. If command-line setup is useful, install the gcloud CLI. The runtime service account does not need broad Owner or Editor access to your Cloud project just to read marketing reports.

  • Under IAM & Admin, create a dedicated service account. If a JSON key is necessary for your local setup and your organization permits it, create one and store it securely. Prefer a supported keyless method when available; do not weaken an organization policy that blocks key creation.

  • Enable the Search Console API. Enable the Analytics Data API and Google Ads API only when you are ready to configure those sources. Enabling an API does not itself grant access to a property or Ads account.

  • Have a property owner add the service account email under Search Console Settings > Users and permissions. Use the lowest permission level that supports the reports you need, never ownership for routine reporting. Configure the connector to request the webmasters.readonly scope.

  • For a connector that uses Application Default Credentials, set GOOGLE_APPLICATION_CREDENTIALS to the JSON file path in the environment of the process that makes the API requests. Confirm the active identity and property with a small read request before scheduling reports.

The Search Console authorization documentation distinguishes webmasters.readonly from the read/write webmasters scope. A restricted prompt is not an access control. Use an appropriately restricted product role, a read-only connector, and an explicit property allowlist. Review inherited access as well as direct grants.

The Application Default Credentials documentation explains how Google libraries locate credentials. GOOGLE_APPLICATION_CREDENTIALS is a file pointer, not an API permission or a universal Hermes setting. It does not automatically switch the active gcloud CLI account. Your connector must support this authentication method and request the appropriate scopes.

Keep the JSON key out of chat, source control, screenshots, and ordinary shared backups. Restrict file access to the process account; on Linux or macOS, permissions such as 0700 for the directory and 0600 for the file are a useful baseline. Restart the relevant process if it needs to pick up a changed environment. Do not print the key to prove that it works.

At Voltti, the documented setup uses a dedicated identity with read-only Search Console access. This article does not claim billing access or working GA4/Ads access for that identity. Our page on AI security and privacy explains the same least-privilege approach.

A historical Search Console report

Ask for an exact property and date range. For example, type this into Hermes after the connection has been verified:

Retrieve the Search Console report for voltti.ai for June 1 through August 31, 2026. Show totals and top queries, and flag missing data or reporting limits.

The panel below is an English translation of the historical report already published in the Dutch article. Query strings and numeric values are preserved; decimal notation is localized. This translation is not a fresh API run, and the original excerpt does not record the search type, row limit, or final/provisional data setting.

Search Console — translated historical report

Google Search Console — voltti.ai (June–August 2026)

Top queries

QueryClicksImpressionsPositionCTR
voltti682.475.0%
ai agent of chatbot03018.20.0%
ai assistent bedrijf01121.50.0%

Totals

MetricValue
Impressions240
Clicks7

The site averages position 2.4 for its brand name. The query "ai agent of chatbot" has 30 impressions at position 18.2, but no clicks. The original report recommended a page addressing that query and relevant internal links from the homepage.

Translated from the published Dutch example: voltti.ai, June–August 2026. Not a new execution transcript.
Search Console — translated historical report

Google Search Console — voltti.ai (June–August 2026)

Top queries

QueryClicksImpressionsPositionCTR
voltti682.475.0%
ai agent of chatbot03018.20.0%
ai assistent bedrijf01121.50.0%

Totals

MetricValue
Impressions240
Clicks7

The site averages position 2.4 for its brand name. The query "ai agent of chatbot" has 30 impressions at position 18.2, but no clicks. The original report recommended a page addressing that query and relevant internal links from the homepage.

What the agent does with the data: from numbers to actions

The historical example reports 240 impressions and 7 clicks across June–August 2026. The brand query has a 75% CTR, but that comes from just 8 impressions. Broader queries have impressions without clicks. These are observations from a small dataset, not evidence that a particular content change will increase traffic.

The original agent recommendation was to address the query "ai agent of chatbot" with relevant content and internal links. Before creating anything, check whether a suitable page already exists. A translation should not turn an old recommendation into a new execution claim, or encourage a duplicate page. Our article on SEO with an AI agent covers the wider review workflow.

For a new report, ask the agent to retain the exact property, dates, dimensions, filters, and data status alongside its recommendations. Query rows may not add up to property totals because of reporting limits and privacy filtering. Compare the export with the Google interface using matching settings before acting on it.

Extend the setup to Google Analytics 4

For GA4, enable the Analytics Data API and add the service account email to the property through Admin > Property access management. Viewer access is sufficient for standard reporting; use the numeric GA4 property ID, not the G- measurement ID. The connector must authenticate with analytics.readonly and call the Data API. Google’s Analytics API quickstart documents the client-library and runReport approach.

Once access is verified, a short request is enough:

Show sessions by channel for the last 30 complete days in our GA4 property. Include the date range and property ID, and list the top landing pages separately.

State the actual start and end dates in the report and retain the property time zone. Check metric and dimension compatibility rather than assuming any two columns can be combined. Channel sessions and landing-page sessions are separate report views; they should not be joined row by row.

An earlier version of this article used invented values to illustrate the GA4 report layout; those values have been removed. The GA4 section is setup guidance rather than a measured report: the documented Voltti example does not include a verified GA4 run.

Google Ads supports direct service-account access. An Ads administrator adds the service account email under Admin > Access and security, as described in Google’s service account workflow. Select Read-only access for reporting and check access inherited through manager accounts. You do not need to impersonate a human user for the documented direct-access flow.

You also need a developer token from the API Center of a Google Ads manager account. Test Account Access only supports test accounts. Explorer Access, Basic Access, and Standard Access can support production accounts, subject to their limits and permitted features. Check the actual level and permissible use in Google’s access-level documentation; a token existing is not proof that production reporting is authorized.

Google Ads uses the adwords OAuth scope, not a separate read-only OAuth scope. Restrict access through the Ads account role and the connector’s allowed reporting methods. Configure the developer token, target customer ID, and, when accessing through a manager account, the appropriate login-customer-id. The Ads client library may require its own key-file setting; setting GOOGLE_APPLICATION_CREDENTIALS alone is not a complete Ads configuration.

Add Ads after the first reporting connection works, then verify GA4 separately if you need it. Technically, Ads does not depend on either source. Working incrementally makes it easier to find a wrong account ID, missing role, or token restriction. Do not turn an authorization error into an instruction to grant administrator access.

After the Ads connection has passed a read test, you can ask:

Report clicks and cost by campaign for the last full month in the Ads account I confirmed. Use reporting calls only, and show the account currency and exact dates.

Combining sources can help you investigate which campaigns bring useful visits, but Search Console impressions, Analytics sessions, and Ads clicks measure different things. Match the date range, time zones, account currency, and attribution assumptions. An agent should explain those differences rather than present them as interchangeable totals.

For example, a business using Moneybird could compare campaign statistics with invoices available through its API for the same period. This is a possible workflow, not a customer result. Attributing revenue to a campaign requires a reliable link between the campaign, customer, and invoice; matching dates alone does not establish attribution. Our guide to connecting AI to a CRM or CMS covers the integration approach.

A service account versus your own Google account

Do not share your Google password. User OAuth is a legitimate alternative to a service account: it can also use limited scopes and revocable consent. The comparison is about who owns the automated access and how you manage it, not a claim that all user authentication gives unlimited access.

ConsiderationYour account through OAuthDedicated service account

Permissions

Limited by your product access and the scopes you approve

Limited by product grants, requested scopes, and connector controls

Access lifetime

Access tokens expire; refresh tokens can renew access until consent or credentials are revoked

Short-lived access tokens are obtained with the configured credentials; a JSON key needs lifecycle management

Review and traceability

Requests use a person’s identity; keep a separate application log

Requests use a distinct machine identity; available provider logs still vary by service

Revoking access

Revoke the app’s consent or tokens; changing your password is not the only option

Remove product access or revoke the key/identity, checking other workflows that depend on it

Read-only access is a deliberate choice

The reporting connections described here should read and analyze data without changing your Google accounts. Enforce that through account permissions and the connector, not just through a sentence in a prompt. For Google Ads in particular, the OAuth scope alone does not impose a read-only boundary.

If you later want the agent to change a bid strategy or another setting, treat that as a separate project with explicit approval and new safeguards. Review credentials and product access periodically, remove unused grants, and keep your own record of requested reports, errors, and actions. Do not assume every read call appears in a complete provider audit log.

Read-only Google access also says nothing about unrelated tools. If the same agent has CMS permissions, it may be able to edit and publish there. People still check the work and decide which goals, claims, and changes are acceptable.

Want help connecting an agent to marketing data for your business in Belgium and the Netherlands? See how a Voltti pilot works, or use the button below to discuss one reporting task.

Seppe Gadeyne

  • Updated on

    Frequently asked questions

    01Is a service account safer than using my own account?

    It can make machine access easier to separate, review, and revoke, but it is not automatically safer. Grant only the product access the job requires, restrict reporting methods, and protect its credentials. User OAuth with limited scopes is also a valid option. Never share your password.

    02Can Hermes make changes in Google Search Console?

    Not through a connector restricted to the read-only scope and reporting methods described here. Read/write access is a different authorization choice. Do not grant it for routine analysis, and do not assume these Google restrictions also apply to the agent’s other tools.

    03Does this work with Google Analytics 4 and Google Ads?

    Both products support service-account reporting when configured correctly. GA4 needs property access and the Analytics Data API. Ads also needs a developer token, appropriate account access, and the correct customer settings. The historical Voltti example in this article verifies neither GA4 nor Ads execution; those sections are setup guidance.

    04What does a Google Cloud service account cost?

    Creating a service account does not itself carry a charge, and the Search Console API is free to use subject to its usage limits. Other Cloud resources, paid services, and the agent’s model usage can have separate costs. Check the services you actually use rather than treating the whole setup as free.

    05Does the JSON key have to be on the same machine as Hermes?

    The process making the API requests needs access to its configured credentials. With a local file-based connector, that usually means a protected file on the machine running the connector, not necessarily the chat interface. Do not paste the key into Hermes. Prefer supported keyless authentication when practical; if a key is necessary, restrict access and rotate or revoke it when required. Any retained backup must be encrypted and stored separately, not on the node. See local and hybrid AI.

    Ready to connect your data to an agent?

    Discuss your pilot