Can your AI tell you which ad monitoring rules your site needs?
Yes, if it sees a real page view. Run a read-only console snippet on your homepage and one article, give the output to Claude or ChatGPT, and it maps your ad tags and slots to rules. A worked example on a news site.

Yes, if you give it a real page view to work from. Open your homepage and one typical article, let the ads load, paste a short read-only snippet into the browser console and hand the output to Claude or ChatGPT. It lists your ad slots, ad libraries and consent tool, and the AI turns each one into a rule. On a large news site we tried this on, two page views gave ten rules.
What makes this work is the input. An assistant that only reads your HTML misses most of what matters, because Google Publisher Tag, Prebid and the consent tool build the ad slots after the page loads. The snippet reads the page as your visitors' browsers see it, a few seconds in.
Why your AI should not guess from the page source
Ask an assistant to "check my site and suggest monitoring" and it fetches the URL. What comes back is the server's HTML: a script tag for gpt.js, a few empty div elements, maybe a Prebid config inline. The slots that GPT defines in JavaScript, the bidders Prebid loads, the ad unit paths and which consent platform answered are all decided in the browser.
So the AI ends up writing rules for a page it has not seen. It guesses selectors, misses slots that only exist on article pages, and has no idea which consent tool you run. A rule built on a guessed selector fires on every page view or never, and either way it gets switched off within a week.
The snippet that gives it real facts
PubPilot's connector hands your AI a short snippet for exactly this step. It reads a handful of globals and the GPT slot list, prints a JSON summary to the console, and stops. It makes no network call, writes nothing to storage and changes nothing on the page. You can read every line before you run it; it is on the PubPilot AI page.
Run it like this:
- Open your homepage in desktop Chrome and scroll once so lazy slots start.
- Wait about ten seconds, until the ads have loaded.
- Open the console (F12, or Cmd+Option+J on a Mac), paste the snippet and press Enter.
- Copy the JSON it prints. Do the same on one typical article page.
It reports, for each page: whether googletag, pbjs, apstag, adsbygoogle and the common consent globals (__tcfapi, __gpp, OneTrust, Didomi, Cookiebot and a few more) exist; every GPT slot with its element id, ad unit path, whether its element is on the page and how many iframes it holds; and the Prebid ad unit codes. Those are the same objects the Google Publisher Tag reference and the Prebid ad unit reference describe, read at the moment you run it.
What it found on a news site
We ran it on 18 November 2026 on the homepage and one article of a large English-language news site. It is not a PubPilot customer, so we leave its name out and mask the network code. The homepage output, shortened:
{
"globals": { "googletag": true, "pbjs": true, "apstag": true,
"__tcfapi": false, "OneTrust": true },
"gpt_slots": [
{ "ad_unit": "/NNNN/post.desktop/rec_atf/home",
"element_id": "div-gpt-ad-rec_atf", "on_page": true, "iframes": 1 },
{ "ad_unit": "/NNNN/post.desktop/billb_top/home",
"element_id": "div-gpt-ad-billb_top", "on_page": true, "iframes": 0 }
],
"iframes_in_slots": 4,
"consent_cmp": ["OneTrust"]
}
The homepage defined 9 GPT slots, 4 of them rendering an ad at that moment, and Prebid had 10 ad units configured. The article defined 16 slots, including ten numbered billboards from div-gpt-ad-billb_1 to div-gpt-ad-billb_10, with 6 rendering. The same top slot, div-gpt-ad-rec_atf, was on both pages. Prebid's ad unit codes matched the GPT element ids, which is common and makes the rules simpler.
Two details change the rules. The billboards exist only on articles, so a check for them must be limited to article URLs, which on this site carry the date as /YYYY/MM/DD/. And the consent tool is OneTrust, not a TCF API, so the consent check looks for OneTrust rather than __tcfapi.
The ten rules it proposed
We gave both outputs to the AI with PubPilot's set-up prompt. It proposed these, as a table with a reason and a severity for each:
| Rule | Check | Pages | Severity |
|---|---|---|---|
| Google Publisher Tag loads | googletag exists, 8 s after load |
All | Critical |
| Prebid loads | pbjs exists, 8 s after load |
All | Critical |
| Amazon tag loads | apstag exists, 8 s after load |
All | Warning |
| Consent tool loads | OneTrust exists, 5 s after load |
All | Critical |
| Top slot is on the page | #div-gpt-ad-rec_atf exists |
All | Critical |
| Homepage keeps its slots | at least 8 elements match [id^='div-gpt-ad-'] |
Homepage | Warning |
| Article billboards render | at least 3 elements match [id^='div-gpt-ad-billb_'] |
Articles | Warning |
| Slots get ads back | custom check: some GPT slot has a response, 10 s after load | All | Critical |
| Impressions drop | GAM: impressions down 30% against the 7-day average | Network | Warning |
| Revenue stops | GAM: zero revenue today | Network | Critical |
The delays matter. Ad libraries load late, so a check that runs the moment the page loads reports a missing googletag on every slow connection. Eight seconds is a starting point; if your tags load later, raise it. Each page rule alerts only after 3 to 5 failed page views in 30 to 60 minutes, so one visitor with a broken extension does not wake anyone up.
Seven of the ten use PubPilot's four standard checks: a global exists, an element exists, a count of elements, text on the page. One needs code. "Some slot got an ad back" cannot be written as a selector, because an empty slot and a filled one can have the same element. Through GPT it is one line:
const slots = window.googletag?.pubads?.().getSlots() ?? [];
return slots.length > 0 && slots.some(s => s.getResponseInformation() !== null);
getResponseInformation() returns null while a slot has no ad, so the check fails when GPT is on the page but nothing came back. Through the connector, code like this has to pass PubPilot's safe-subset checker before it can be saved. The checker described this one as reading only Google Publisher Tag and the slots' responses, unable to send data anywhere, change the page or read cookies.
What to check before you say yes
The AI writes good first drafts. You still know your site better, so read each proposal against it:
- Selectors that exist only on some templates. Live blogs, galleries and AMP pages often have their own slot ids. If a rule covers "all pages", open one of each template and check the element is there.
- Counts set from one page. The homepage had 9 slots that day; a slow news day or a takeover can change that. Set counts a little below what you saw.
- The consent check in each region. A site can run one consent tool in Europe and another in the US. Run the snippet with a VPN or ask your team which tool loads where.
- Custom code. Read it in full. With PubPilot's connector the preview shows the exact code and a plain line of what it reads, and nothing is saved until you confirm.
- GAM alert periods. Revenue and impressions build up through the day, so a percentage drop on today fires every morning. Compare yesterday with a baseline, and keep "today" for zero-activity checks.
Doing it with the connector
You can do all of this in a plain chat by pasting the snippet output and asking for rules, then entering each one in your monitoring tool by hand. With the PubPilot connector for Claude or ChatGPT, the AI also calls the tools: it reads your plan and domains, gives you the snippet, and creates each rule as a preview that waits for your yes, with every change logged and undoable. The connector address, the steps for both assistants and the set-up prompt word for word are on the PubPilot AI page.
Questions people ask
- Can ChatGPT or Claude read my page and write monitoring rules on its own?
- It can read the HTML a server sends, but ad tags run after the page loads, so the slots and bidders it needs often are not in that HTML. A console snippet run in your own browser after the ads load gives it the real list of slots, globals and the consent tool. With the PubPilot connector it then writes the rules as previews for you to confirm.
- How many monitoring rules does a site need to start?
- About ten covers most publishers: one per ad library (GPT, Prebid, any other bidder wrapper), one for the consent tool, one for the most valuable slot on every page, one count of slots per page type, one check that slots get ads back, and two Google Ad Manager alerts for an impressions drop and revenue going to zero.
- Is it safe to let an AI create rules that run on my site?
- Only with limits. PubPilot's connector turns every change into a preview that needs your yes, accepts custom code only in a checked read-only subset of JavaScript, logs every change with an undo, and never fetches your pages. Read the full code of any custom check before you confirm it.
Sources
- Getting started with custom connectors using remote MCP (Claude Help Center)
- Add custom MCP server (OpenAI developer docs)
- Google Publisher Tag reference, PubAdsService.getSlots and Slot.getResponseInformation (Google for Developers)
- Ad unit reference (Prebid.js documentation)
- Model Context Protocol, introduction