Skip to content
Peal
Esc
↑↓navigate↵open⌘Jpreview
On this page

Ads

Turn ads on for a self-hosted server, and what Meta and Google ask of the operator of their apps.

Ads stay off on your server until you set PEAL_ADS. Before that, you need a Meta app of your own with ads access, and for Google Ads an OAuth client of your own. Meta and Google each ask a few things of whoever runs them.

Turn ads on

PEAL_ADS takes one of three values:

PEAL_ADS What workspaces may do
off or unset Nothing. Ads are off.
read Connect ad accounts and read their campaigns and numbers
spend Also boost published posts, which spends their money at Meta

PEAL_ADS_NETWORKS names the networks you offer, and is meta when unset. Add google to offer Google Ads, which is read only. spend needs meta in the list.

Your instance brings its own Meta app with ads access, because Peal Cloud’s app doesn’t serve self-hosted servers. Ads use Meta’s main app, the one Facebook Pages connect with (META_APP_ID, META_APP_SECRET). They also need PEAL_TOKEN_KEYS to encrypt the sign-ins’ tokens.

If you set PEAL_ADS to read or spend without that app, the server stops at startup.

Get the ads permissions from Meta

Apply for what Meta asks of the operator, on the app in META_APP_ID.

Register the redirect address

On the app, register the address that the command prints for ads, as a valid OAuth redirect URI.

Start on read

Set PEAL_ADS=read until Meta has granted the app ads_management. Members can connect ad accounts and read them, and the sign-in asks for reading only. Everything that spends answers AdSpendingUnavailable.

Move to spend

Once Meta has granted ads_management, set PEAL_ADS=spend. People who signed in before then sign in again to allow running ads.

The server calls Meta’s Graph API for ads, as it does for Facebook Pages. Whatever the access tier, Peal stops reading an ad account at 75% of the rate limit Meta reports for it.

What Meta asks of the operator

This is what Meta’s documentation asks for at the time of writing. Meta’s rules change, so confirm each one with Meta when you apply (Authorization, Rate limiting):

Requirement What it is
Permissions ads_read to read ad accounts and their reports. To boost, also ads_management, pages_show_list, pages_read_engagement and pages_manage_ads.
App Review, with advanced access For each permission, to act for other people’s ad accounts. An app that only manages its own ad account can work with standard access.
Business verification Of the business that owns the app
Marketing API access tier An app starts with limited access, whose rate limits per ad account are low. It gets full access after App Review and enough successful calls. Meta’s page says 500 calls in 15 days, with an error rate under 15%.

Google Ads

With Google Ads, members connect accounts and read their campaigns, with each campaign’s daily cost, impressions and clicks. Peal never writes anything to Google Ads. It needs an OAuth client of its own, separate from the ones for YouTube and Google Business Profile.

Enable the API

Use a Google Cloud project linked to a paid billing account, because Google gives a project on its free trial nothing beyond Test access. In the API library, enable the Google Ads API. The project now has Test access.

Set up the consent screen

Under Google Auth Platform, go to Data Access and add the scope https://www.googleapis.com/auth/adwords. Google has no read-only scope for Google Ads, so Peal asks for this one and writes nothing.

Create the client

Under Clients, create a Web application client. Add the address that the command prints for Google Ads (PUBLIC_URL/connect/ads/google/callback) as an authorized redirect URI. Put the client in GOOGLE_ADS_CLIENT_ID and GOOGLE_ADS_CLIENT_SECRET.

Name the network

Set PEAL_ADS=read, or spend for Meta’s boosts, and set PEAL_ADS_NETWORKS=meta,google, or google alone. PEAL_TOKEN_KEYS encrypts each sign-in’s refresh token.

How many accounts an access level reads

There’s no developer token to set. Google retired them on 9 September 2026, and the access level now belongs to the Cloud project that owns the client (Access levels). Peal reads each account every six hours, and a read costs three operations: the account, its campaigns and their days. Further pages of an answer aren’t counted. Each level then covers about this many accounts:

Access level How you get it Operations a day Accounts at six hours a read
Test Enable the API 15,000, on test accounts only Test accounts only
Explorer Click Apply for access on the Cloud console’s Google Ads API page. Google may grant it at once. 2,880 on real accounts About 240
Basic Apply once the project’s brand is verified. Google reviews it within minutes. 15,000 About 1,250

Listing the accounts a sign-in reaches costs operations too: one, plus one for each account the person uses directly or manages (50 at most). Peal keeps a listing for five minutes, for the steps right after it. A sign-in gets ten listings an hour and a workspace thirty.

Listings across the whole server spend 300 operations a day at most, and one workspace 100 of them. Past that, connecting answers that Google asked to wait, and the reads keep the rest of the quota. With that share kept for listings, the table’s figures come to about 215 accounts at Explorer and 1,225 at Basic. An account the sweep reaches late in its run is still read every six hours, counted from the time of the sweep.

A read longer than Peal fetches at once (400,000 rows of days) picks up from the last day it reached, a few times. If it’s still cut short, the account isn’t marked read, the server logs an error, and Peal waits six hours before reading it again.

What fails before Google approves the project

A project at Test access reads test accounts only. Google refuses real ones with CLOUD_PROJECT_NOT_APPROVED_FOR_PRODUCTION, which the server logs as an error. Google may withdraw access that goes unused for 90 days.

While the consent screen is in Testing, only its test users can sign in, 100 at most, and their sign-ins end after seven days. Peal then shows those accounts as needing to reconnect.

Before people outside your organisation connect, publish the consent screen and verify the brand. Then have Google verify the adwords scope, which takes a justification and a video of the sign-in and of what Peal shows (Brand verification). Everyone who signs in needs a passkey on their Google account (Security requirements).

For Google Ads, the server calls oauth2.googleapis.com and googleads.googleapis.com, on version v26 of the API. Google ends v26 in November 2027.

Was this page helpful?