Google (GPT) passback tags in a placement
A Google Ad Manager passback tag renders once and leaves the slot blank on every reload, Google returns no ad and the impression is lost, or one localized path never fills — a 60-second check, a cause table, why each happens and the finished tag that fixes all three.
“The Google passback shows once, then every reload leaves the slot blank.” “Google had no ad,
and the slot stayed empty — but Epom counted the impression.” “Our /de pages never fill,
everything else does.” An HTML Code banner whose markup is a Google Publisher Tag hands your
inventory to Google Ad Manager and shows whatever GAM returns. These three things go wrong with
such tags specifically, and none of them is visible in Epom’s reports — the placement looks
filled every time. All three are fixed in the banner’s markup; the rest of this page is the
reasoning and the finished tag.
Example. A 300×250 placement with Refresh after (sec) = 30 carries a GPT passback banner. A reader who stays five minutes gets 10 ad calls; with the “reuse the slot” tag only the first renders, so General reports show 10 impressions for 1 ad seen. With the finished tag below, each reload destroys the stale slot and defines a fresh one, and when GAM answers empty the creative posts the passback message: the loader re-requests the ad with that banner excluded, the next eligible banner takes the slot, and the hour’s statistics subtract the empty impression — so the 10 calls become 10 counted ads, 7 from Google and 3 from the backfill.
The Epom side of each fix — the message the creative posts and how the loader and the ad server
react to it — is checked against the ad server’s code. The googletag calls are Google’s API,
not Epom’s: confirm them against Google’s current GPT reference before rolling a tag out,
because Epom does not control how they behave.
The 60-second check
- Does the tag reuse an existing slot? Search the banner’s code for
getSlots()followed by a “define only if missing” branch. That renders once:googletagkeeps a slot registry in the page’swindow, which survives the reload. Destroy the stale slot and define a fresh one (renders once). - Does the tag report an empty fill? Look for a
slotRenderEndedlistener that posts the passback message whene.isEmpty. Without it, a Google no-ad is written off as delivered and the Default code never fires (Google returns no ad). - Is there something to serve second? A backfill banner behind the passback in a daisy chain, or the placement’s Default code — the exclusion is pointless otherwise.
- Is the element id unique on the page? Two placements with
gpt-passbackbreak rendering,defineSlotanddestroySlotsat once (unique id). - Only one localized path is dark? Set
document_languagefrom the page’s<html lang>beforeenableServices()(one localized path).
Causes at a glance
| Symptom detail | Cause | Check | Fix |
|---|---|---|---|
| First impression fine, every reload blank; placement has Refresh after (sec) | The tag reuses the slot GPT kept from the previous impression; display() on an already-displayed slot does nothing | The banner code for a “reuse if exists” branch | destroySlots the stale slot, then defineSlot afresh |
| Blank slot, but Epom reports the impression and the Default code never fires | GAM returned no ad; the creative did not tell Epom | Is there a slotRenderEnded / isEmpty listener posting the passback message? | Add the listener; link a backfill or set the Default code |
| Nothing renders at all, no error in Epom | Slot.addEventListener threw in a GPT build that lacks it; GPT abandoned the queued command before display() | The browser console for TypeError | Register listeners on googletag.pubads() |
| The request is lost silently when the id is already claimed | defineSlot returned null, so no slotRenderEnded ever arrives | Is there an else branch posting the passback? | Add the else branch |
| Two ads on one page render into each other’s container, or one never renders | The same element id in two banners | The ids across all passback banners on the page | One id per placement, used in all four places |
| Reloads tear down the other ad’s slot | Same cause: destroySlots matches by id | As above | As above |
/de (or another localized path) fills nothing while the rest serves | GPT misclassified the page’s language as unsupported | Google support, for that exact URL | Set document_language before enableServices() |
| Impressions in General look right, but Advanced shows both the impression and a passback | Expected: General subtracts corrected impressions, Advanced keeps both raw events | Valid passbacks / Rejected passbacks columns | Nothing to fix |
| A small over-count survives the correction | The impression and the passback landed on different ad servers and the network does not run Advanced reporting | Ask your network administrator | Expected on such networks |
| The correction is lost although the message is sent | wi: true added an impression the subtraction then cancelled | The message in the tag | Leave wi out on a GPT tag |
| Language targeting stopped working after switching to the Friendly Frame wrapper | The creative reads the frame’s document, where lang is empty | The placement’s Ad wrapper | Pass the language as a literal |
Who this is for
Publishers and network managers who paste GPT passback markup into an HTML Code banner. Nothing here needs anything beyond the banner editing you already do. A slot that Epom’s own header-bidding runtime fills is a different mechanism — see Header bidding.
Symptom: renders once, then every reload is blank
The placement has Refresh after (sec) set (Advanced settings), the first impression looks right, and every reload after it leaves an empty slot.
This is not a duplicate-id problem. Before it injects the new ad, the Universal JS loader
hides the previous one and strips the id attribute off every element inside it, so two
<div id="gpt-passback"> never coexist on the page.
What survives the swap is GPT’s own state. googletag lives in the page’s window, not in the
DOM, and it keeps a slot registry keyed by element id. Replacing the markup does not reset
it. So a tag written as “reuse the slot if it already exists” finds the slot left by the
previous impression, skips defineSlot, and display() on an already-displayed slot does
nothing:
// renders once, then never again
var slot = googletag.pubads().getSlots().find(function (s) {
return s.getSlotElementId() === "gpt-passback";
});
if (!slot) {
slot = googletag.defineSlot(AD_UNIT, SIZES, "gpt-passback");
}
Destroy the stale slot instead of reusing it, and define a fresh one on every impression:
var stale = googletag.pubads().getSlots().filter(function (s) {
return s.getSlotElementId() === "gpt-passback";
});
if (stale.length) {
googletag.destroySlots(stale);
}
var slot = googletag.defineSlot(AD_UNIT, SIZES, "gpt-passback");
destroySlots also removes the previous ad’s iframe from the old container, so nothing is left
behind.
Symptom: Google returns no ad and the slot stays empty
GAM answered “no ad”. Epom cannot see that: from its side the request was filled — by the banner carrying the passback tag — so the placement’s Default code never fires. The blank happens later, in the browser, and the request is written off as delivered.
Have the creative report the empty fill. The loader then re-requests the ad with that banner excluded, and the next eligible banner takes the slot:
googletag.pubads().addEventListener('slotRenderEnded', function (e) {
if (e.isEmpty && e.slot === slot) {
window.postMessage(JSON.stringify({
by: "$$AJAX_INVOCATION_CODE_KEY$$",
key: "$$PLACEMENT_KEY$$",
bId: $$BANNER_ID$$,
pb: true
}), '*');
}
});
The macros are substituted when the markup is generated — paste them as-is. The message format and the parameters that control what gets excluded are documented under Templates; the same mechanism works from any creative that can detect its own failure, not only GPT.
Then make sure something can actually serve second — the exclusion is pointless if the placement has nothing else to offer:
- Link a backfill banner (house, direct or programmatic) to the placement and put the passback banner first with daisy chaining. Without daisy chaining, normal weighted rotation shows the backfill on ordinary requests too, not only on unfilled ones.
- Or set the placement’s Default code (Advanced settings; it needs the Placement Default Code permission) as the last resort — it is returned once no eligible banner is left after the exclusions.
Symptom: one localized path fills nothing while the rest of the site serves
Fill on /de (or any other localized path) sits at zero while the same ad units, the same
placement and the same tag fill normally everywhere else. Nothing on your side distinguishes
those requests.
GPT decides the page’s language on its own, and Google’s classification of a URL can get it wrong — a path misclassified as an unsupported language stops being monetized entirely, so the slot is never filled rather than filled cheaply. The tag can override the detection per request by reading the page’s declared language:
var language = document.documentElement.lang;
if (language) {
googletag.pubads().set('document_language', language);
}
This runs before googletag.enableServices() — after services are enabled the value no
longer reaches the request. If the page does not declare lang on <html>, pass the language
code as a literal instead of reading the attribute.
The misclassification itself is on Google’s side, and only Google can confirm it for a given URL — the question to ask their support is what their system holds against that exact URL, not why it is unfilled. But the override lives in the markup you paste here, so it is worth setting on every localized site before escalating anything.
Corner case: measure this with an interleaved A/B, never with single page views. When overall fill is around 20%, an empty slot is the expected outcome for a large share of views, and any single observation “proves” whatever you hoped for.
The finished tag
Both fixes together. Only the element id, the ad unit path and the sizes change per placement:
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js" crossorigin="anonymous"></script>
<div id="gpt-passback" style="width:300px; height:250px;"></div>
<script>
window.googletag = window.googletag || { cmd: [] };
googletag.cmd.push(function () {
var passbackMessage = JSON.stringify({
by: "$$AJAX_INVOCATION_CODE_KEY$$",
key: "$$PLACEMENT_KEY$$",
bId: $$BANNER_ID$$,
pb: true
});
var language = document.documentElement.lang;
if (language) {
googletag.pubads().set('document_language', language);
}
if (!window.gptServicesEnabled) {
googletag.enableServices();
window.gptServicesEnabled = true;
}
var stale = googletag.pubads().getSlots().filter(function (s) {
return s.getSlotElementId() === "gpt-passback";
});
if (stale.length) {
googletag.destroySlots(stale);
}
var slot = googletag.defineSlot(
"/NETWORK_CODE/AD_UNIT",
[300, 250],
"gpt-passback"
);
if (slot) {
slot.addService(googletag.pubads());
googletag.pubads().addEventListener('slotRenderEnded', function (e) {
if (e.isEmpty && e.slot === slot) {
window.postMessage(passbackMessage, '*');
}
});
googletag.display("gpt-passback");
} else {
window.postMessage(passbackMessage, '*');
}
});
</script>
The else branch matters: defineSlot returns null when the element id is already claimed or
the ad unit path is malformed, and in that case no slotRenderEnded ever arrives — without it
the request would be lost silently.
The element id must be unique on the page
gpt-passback above is a placeholder. The id has to be unique across the whole page, not
just within the banner — give each placement its own (gpt-passback-leaderboard,
gpt-passback-skyscraper-2, …) and use that same string in all four places: the <div>, the
filter, defineSlot and display.
Reusing one id for two ads on the same page breaks all three mechanisms at once:
getElementByIdresolves to the first matching<div>, so the second ad renders into its neighbour’s container or nowhere;defineSlotreturnsnullfor the second slot because the id is already claimed — with theelsebranch above that at least passes the request back instead of losing it, but the GAM demand for that slot is gone;- on reload, each tag’s
destroySlotsmatches by id and would tear down the other ad’s slot.
Two placements may serve the same ad unit path — that part is fine. It is the element id that must differ.
Corner cases and gotchas
Slot.addEventListeneris missing from some GPT builds and throwsTypeError. GPT catches it, logs it, and abandons the rest of the queued command — so a failure while wiring up a listener also skips thegoogletag.display()below it, and nothing renders at all. Register listeners ongoogletag.pubads(), and keep anything optional out of the path that leads todisplay().
Listeners registered on
googletag.pubads()are not removed on reload. They accumulate for as long as the page lives — harmless (each closure only matches its own slot, and stale slots never fire), but on very long sessions consider registering one listener per page and keying the message bye.slot.getSlotElementId().
Exclusions last for the current cycle only. The next scheduled reload starts clean, so the passback banner gets the first chance again on every rotation.
The empty impression is recorded first and corrected afterwards. The banner’s tracking fires when the markup renders, before GPT decides it has no ad — so the impression is real at that moment. Sending the passback message is what corrects it: when the hour’s statistics are processed, every passback subtracts one impression (count, gross and net) from the matching aggregate, so General reports settle on the corrected figure. This only happens for banners whose creative actually reports the empty fill — a passback tag left as-is keeps every blank counted as an impression.
Advanced reports do not subtract. They keep both raw events, which is the honest record — read Impressions against Valid passbacks (a passback matched to the impression it corrects) and Rejected passbacks (no matching impression was found) there; see the metrics reference. One consequence: if the impression was recorded by a different ad server than the passback, the correction is written as a negative impression row so the two report families agree — and only when the network runs Advanced reporting. Without it the correction is dropped rather than pushing a counter below zero, so a small over-count can survive. See My fill rate is low.
The banner’s own Enable passback functionality checkbox is not needed for this tag. It generates a ready-made snippet for a creative that simply has nothing to show (see HTML Code banners), and it needs the Ajax invocation-code permission of the placement type, which the stock Advertiser role does not hold. The message above goes through the Universal JS loader instead, and the ad server logs a passback for any call that reaches it on an ajax (Universal JS) domain.
wi: trueadds an impression that the subtraction then cancels. It exists for flows where the impression beacon never fired at all, so the passback has something to subtract from. On a GPT tag the beacon has already fired, so leave the flag out — with it the two cancel and the correction is lost.
The Friendly Frame ad wrapper sidesteps the reload problem entirely. Set it as the placement’s Ad wrapper (Ad tags & API → Settings) and each reload renders into its own iframe document with its own
window, so no GPT state carries over. The trade-off: the creative then reads the frame’s document, sodocument.documentElement.langis empty and language targeting derived from it is lost. The frame is same-origin, and the loader setsinDapIF = trueinside it.
Libraries other than GPT need the same idea in their own vocabulary. If a teardown API exists (most video players), call it before re-initialising. If none exists (
adsbygoogleand similar), make the element id unique per impression with the$$RANDOM$$macro (id="passback-$$RANDOM$$") and use the same value in the script.
Deeper diagnostics
| Tool | What it shows | Where |
|---|---|---|
| Browser console on the live page | GPT’s own errors (TypeError from a missing Slot.addEventListener, a malformed ad unit path) and whether the passback message was posted | The publisher’s page, with a reload cycle or two |
| General report grouped by Placement | Impressions after the hour’s correction; a placement with Refresh after whose impressions equal one per page view has the render-once tag | Account → Analytics |
| Advanced report | Impressions against Valid passbacks and Rejected passbacks — the raw record of every empty fill the creative reported | Account → Analytics, Type of reports: Advanced (metrics reference) |
| An interleaved A/B of the old and the fixed tag | Whether a language or reload fix changed fill — never judge from single page views when fill is around 20% | Two banners in rotation on the same placement |
When you escalate
Before asking Google about an unfilled path, set document_language in the markup and measure
with an A/B; what to ask their support is what their system holds against that exact URL. For
the Epom side, give your network manager: the placement ID, the banner ID carrying the
GPT tag, the tag’s markup as pasted, the page URL, the placement’s Refresh after and
Ad wrapper settings, and the time window — the ad server logs a passback for any call that
reaches it on an ajax (Universal JS) domain, so your network administrator can confirm whether the
messages arrive.