Native ad-spend connections

Connect Google, Meta or Microsoft advertising costs to recorded first-party revenue, and import StackAdapt costs with clear measurement boundaries.

Last updated November 29, 2026

Before you connect

This workflow requires the native-spend release to be deployed and provider API access to be configured. Having an ad dashboard or conversion-import spreadsheet does not supply API authorization.

Install Site Tracking and record conversions if you want revenue attribution. You can read spend without collecting visitor journeys, but revenue cannot be joined to unobserved visits. Analytics consent, sampling and tracking limitations still affect coverage.

Open Attribution → Advertising economics → Native ad accounts.

Native read-only connections cover Google Ads, Meta Ads and Microsoft Ads. StackAdapt is available for tagged website clicks, cost CSV imports and budgets; its native reporting connector remains disabled pending verified API access. See Microsoft setup and StackAdapt and OTT/CTV measurement.

Connect Google Ads

  1. Select Google Ads under Ad platform.
  2. Choose Connect Google Ads, sign in to Google and approve the requested Ads access. Use an account permitted to read the advertiser’s reports.
  3. After returning, enter Google advertiser account ID, the ten digits shown in Google Ads. Pasted spaces or hyphens are removed.
  4. If access goes through a manager account, also enter its ten-digit ID under Manager account ID. This is not the advertiser account ID.
  5. Choose whether to refresh recent costs automatically, then select Verify Google Ads account.
  6. Check the returned account name, currency and time zone before syncing.

If the page says Google Ads spend is not configured, the AEO Goal platform needs Google Ads API developer access and OAuth setup first. This is separate from a Google Ads import Sheet. See the administrator section below.

Use Reconnect Google Ads when authorization expires or is revoked. Completing reauthorization cancels pending synchronization for that connection; select the advertiser account again afterward. Financial history remains recorded.

Connect Meta Ads

  1. Select Meta Ads under Ad platform.
  2. Enter the numeric Meta ad account ID from the chosen account in Ads Manager. Enter digits only, without act_.
  3. Paste an access token permitted to read that account’s Insights into Meta spend access token. Prefer a business system-user token restricted to the required account and read permissions.
  4. Choose whether to refresh recent costs automatically, then select Verify Meta Ads account.
  5. Verification reads the account and a completed local day’s Insights before storing the encrypted token. Check the account name, currency and time zone.

An Ads Manager login alone does not produce this token. Ask the business’s Meta app administrator to provide the appropriate read authorization through your normal secure process. Never paste the token into chat or support messages. This is a separate credential from Meta Conversions API sharing.

Use Change ad account to verify replacement account access or a new token. Disconnect Meta Ads revokes the stored connection and cancels pending jobs. An already in-flight read cannot be recalled, but a cancelled job cannot commit its financial import afterward.

Synchronize and inspect costs

Choose a Sync lookback, then select Sync costs now. Follow Synchronization until it succeeds or shows an actionable failure.

  • Automatic refresh targets hourly updates over the latest seven account days.
  • Manual synchronization supports up to 31 account days.
  • Recovery checks run every 15 minutes. Provider quotas, outages and worker availability can delay completion; temporary failures retry with backoff.
  • Repeated clicks reuse the active job. New requests have a five-minute cooldown.
  • Daily campaign totals must reconcile with daily account totals. Partial, malformed or oversized reports are not imported as complete data.

Financial entry history preserves originals and corrections. Provider restatements append corrections instead of overwriting previous costs. Repeated identical snapshots do not duplicate spend or observation history. Native reports include campaigns, ad groups (Google) or ad sets (Meta), and ads where supported. Account, campaign, ad-set and ad report rows are independent inclusive totals: never sum rows from different hierarchy levels. Google Performance Max and other campaign types may not report these child levels. Missing children are unknown, not proof of zero spend or complete coverage.

Read observed names and coverage

Under the selected native account, Spend observation history shows when a snapshot was observed and the source account-calendar reporting window in which those changes were first observed. Select an observation, then use Older observations / Newer observations or More scopes / Previous scopes to page through its history and dimensions.

Names reflect what the provider reported at synchronization time. They do not establish the names used on a past reporting day. Exact account, campaign, ad-group/ad-set and ad IDs define each scope. An unchanged refresh reuses the existing observation timestamp; Last successful sync shows synchronization freshness. New observed entities, names or parent relationships create immutable metadata changes. Cost-only changes do not.

History contains partial batches of observed name and parent changes, not a complete ad catalog. Missing entities in a shorter lookback do not mean deletion or zero spend. An omitted provider name does not erase a known name. Child cost coverage belongs to the financial report and synchronization metadata, not name history; reported child sums do not establish a complete catalog.

Hourly cost corrections, new reporting days and changing lookbacks do not create name history when observed entity names and parents are unchanged. Monetary restatements remain in Financial entry history. Name history and financial entries survive the 30-day synchronization-job cleanup.

If synchronization reports Spend history capacity reached, existing financial entries remain unchanged. Ask your workspace administrator to review retained name metadata with support, then choose Sync costs now. Reconnecting does not free capacity. A metadata-change batch over the size limit needs a shorter Sync lookback; the service never silently truncates observed changes.

Match visits and revenue

Expand Match recorded visits to this spend hierarchy. Copy the generated parameters into your ad platform’s URL tracking settings. Google uses its final URL suffix with {campaignid}, {adgroupid} and {creative}; Meta uses its URL parameters with {{campaign.id}}, {{adset.id}} and {{ad.id}}. The generated parameters include aeo_ad_account, aeo_campaign, aeo_adset and aeo_ad. Keep your existing auto-tagging and campaign parameters.

The supplied account ID and available dynamic hierarchy IDs must reach the landing URL recorded by Site Tracking. Do not add duplicate copies of these parameter names. AEO Goal joins exact observed IDs, not campaign names or guessed matches. Missing or ambiguous IDs leave campaign revenue Unknown.

These are observed attribution results. They can differ from ad-platform conversion reports because of consent, identity, lookback and model differences. A successful spend import is not proof that an ad caused a sale or that Google or Meta accepted an uploaded conversion.

COGS, budgets and time zones

Native reads do not supply your cost of goods sold or your internal budget plan. To add those inputs, choose Record daily costs and enter:

  • Actual spend: 0, so imported spend is not duplicated.
  • The same account ID, campaign ID, currency and account time zone.
  • The relevant date, COGS and planned daily spend. Use explicit zero when known; leave unknown values blank.
  • A stable external record ID for safe retries and correction history.

Enter each relevant financial day. Missing COGS leaves contribution profit unknown; a missing plan leaves pacing unknown. Contribution profit subtracts recorded spend and COGS only, excluding taxes, fees and other operating costs.

Each financial row uses its account’s calendar dates through now, including partial today. The overview uses a rolling window, so first-day boundaries can differ. EUR and USD stay separate; no currency conversion is performed. Parent and child reporting scopes are independent and must not be added together.

Administrator setup

For Google, configure backend secrets GOOGLE_ADS_DEVELOPER_TOKEN, GOOGLE_ADS_CLIENT_ID and GOOGLE_ADS_CLIENT_SECRET using the deployment’s existing secret-management process. The OAuth client can fall back to the platform’s Google client configuration. Never put these secrets in frontend VITE_ variables.

Register this authorized redirect URI for the production Google OAuth web client:

https://api.aeogoal.com/api/attribution/site/ad-spend/google/oauth/callback

The deployment’s API_BASE_URL determines that callback; APP_URL determines the return to the app. Complete Google’s required production API and OAuth verification before connecting customer accounts. Prefer read-only advertiser roles. The integration requests Ads authorization but implements only report queries, with no advertisement mutation endpoints.

The worker and scheduler must run the deployed schema and registered native spend tasks. Global dispatch uses the existing worker database role; API reads remain tenant scoped and PostgreSQL RLS protected. Operational job history lasts 30 days; financial ledger entries persist until brand deletion.

Bounded metadata storage and safe maintenance

Each canonical ASCII-escaped UTF-8 metadata-change batch is limited to 512 KiB. Retained metadata payloads are limited to 32 MiB per account/provider/currency/time-zone scope. There is no hourly-observation count quota. Only actual newly observed metadata consumes capacity; monetary changes, day changes, shorter windows and missing entities do not append duplicate names. Only an entity’s own name and exact parent IDs are retained, avoiding copies of all parent names when a campaign is renamed. A → B → A renames remain three observations. Names are never claimed to be valid as of a historical reporting day.

The customer endpoint returns at most five change-batch summaries or 50 metadata rows per request with keyset cursors. The displayed report window belongs to the first observation of that change, not the latest cost refresh. Partial batches must not be interpreted as a complete catalog or a list of deleted ads.

Meaningful name/parent changes are retained with financial history until brand or owner deletion. Before rejecting a new metadata batch for byte capacity, the sync importer attempts one bounded duplicate-cleanup pass in the same transaction. It scans at most 1,000 headers and removes at most 100 adjacent identical metadata copies older than 90 days, keeping each first state and the newest observation. It then checks the byte limit again. Genuine metadata changes are never deleted to make room: if they fill the budget, synchronization still fails honestly and rolls back its financial and metadata changes.

There is no scheduled age-based deletion of meaningful history. For an operator reviewing redundant copies beyond that single scan, call cleanup_spend_history from services.attribution.ad_spend_retention in an authenticated owner-bound transaction, follow its next_after_id cursor until null, and commit each bounded batch. The result reports removed duplicate counts and zero financial rows removed. This is a callable operational helper, not a registered background task. Normal imports already prevent new duplicate name records.

Provider references: Google Ads API authorization, Google query pagination, Meta ad account Insights.

Frequently asked questions

Does this change my ads or upload conversions?

No. These connections read campaign and available child-level spend. Meta conversion sharing and Google Ads conversion feeds are separate Site Tracking features.

Does this require GA4?

No. Spend comes from the ad platform. Attributed revenue comes from your recorded first-party conversions and journeys.

Does a successful synchronization prove the platform accepted my conversions?

No. Success means daily campaign costs reconciled with account totals and were imported. It does not prove conversion-feed acceptance or causal return on ad spend.