---
id: connectors/google-ads-search
title: Existing-account Google Ads Search
summary: Compose reviewed Search campaigns with project-owned Google OAuth and portable saved plans.
keywords: google, ads, search, campaigns, conversion, cli, connectors
requires: @jskit-ai/connectors-core, @jskit-ai/connectors-catalog
---

# Existing-account Google Ads Search

## Use when

Use the application's normal configuration, Env resolution, OAuth connection
store and authenticated administrator policy. This is an optional application
command composition fragment, not an editor dependency of the runtime library.

## Framework APIs

```js
import { createGoogleAdsSearchService } from '@jskit-ai/connectors-catalog/server/google-ads-search';
const ads = createGoogleAdsSearchService({ connections, configuration, context, integrationId });
const review = await ads.preview(); // local and Google validation only
// Only after the administrator reviews it:
const created = await ads.create(review.reviewId); // starts PAUSED
```

`configuration.extensions.googleAdsSearch[integrationId]` holds the saved plan.
Validate it with `validateGoogleAdsSearchPlan` from the package's shared
`google-ads-search` export. Keep OAuth settings separate so campaign edits do not
invalidate consent. The runtime has no command protocol, frontend, Env injection or
storage owner. CLI apps can call it directly. Normal `connections.authorize` must
authorize the trusted application's advertising administrator for each operation;
never accept a subject identity from a request body.

When a host runs the app's integration setup command, compose `example/ads-setup.js`
into that command and return exactly one JSON result on stdout. Pass the host's
request protocol as the fragment's third argument: `protocol`, the id its requests
carry and its response echoes, and `maxResponseBytes`, the largest response it
accepts; the host's own command contract names both. Derive `context` and the
allowed integration ID from trusted command composition before calling the
fragment. Keep connection status/connect/reconnect/disconnect operations intact.
Other frameworks implement its JSON/Env and operation contract with their native
libraries; they do not execute this JavaScript fragment.

The Search recipe supports only non-political manual-CPC campaigns with one ad
group, phrase keywords and a website conversion goal. Account creation, PMax,
Demand Gen, billing provisioning and automatic assistant tool attachment are not
implemented. Google API validation does not establish account approval, website
readiness or conversion-tag installation. The operator must verify those before
the separately reviewed launch. Lost write responses are uncertain: inspect the
provider instead of replaying the operation. Disconnect does not stop ad spend.

## Do not use when

Do not use this recipe to provision accounts, build PMax/Demand Gen campaigns or
expose an unrestricted advertising endpoint to unauthenticated app users.

## Product decisions

Select the existing client account, website lead goal, location/language, budget,
manual CPC bid and copy. Store them in the saved Search plan, not OAuth settings.
Confirm non-political advertising and separately approve actual launch/spending.

## Invariants

The application owns the Google connection, trusted account authorization and
persistent OAuth grants. Reviews include live account values and the saved plan.
Creation is paused and atomic; launch rechecks the live review. Do not replay a
write after an uncertain response. Disconnecting does not pause campaigns.

Each collaborator the composition receives (the `createGoogleAdsSearchService()`
service) is a required parameter typed in a JSDoc `@param` and called directly,
without a `typeof` probe, a "requires x" guard or a no-op default. A server
feature that uses it follows
[typed features](https://github.com/mobily-enterprises/jskit-ai/blob/main/packages/agent-docs/site/guide/framework/typed-features.md).

## Example files

`example/ads-setup.js` maps a host's optional setup command to the shared service. It
contains no HTTP endpoint, credential resolution or trusted-identity inference.

## Variation points

CLI apps invoke the service directly. App-owned setup commands adapt the same
service to their host. Other frameworks use native Google APIs and the same
portable plan/operation semantics; they do not run this JavaScript fragment.

## Verification

Use controlled provider responses to check precise money strings, targeting,
OAuth preservation, validate-only review, paused creation, stale-review rejection,
explicit launch confirmation and no automatic replay of failed writes. Test
normal application authorization before resolving credentials. Actual Google
approval and conversion/billing readiness require operator verification.

## Avoid

Do not put secrets in JSON, stdout or chat. Do not execute conversion snippets in
the editor, confuse OAuth consent with advertiser approval, or claim live account
acceptance from fixture tests. Keep larger campaign types outside this recipe.

Do not probe a collaborator, default one to `null`, `{}` or a no-op, fill a slot
with a setter after construction, or keep a module-level registry.
