Debugging Google Ad Manager
The Google Publisher Console is the primary debugging tool for GAM.
Accessing the Console
Append this to your URL:
?googfc
Console Features
The Publisher Console shows:
- Slots - All ad slots on the page
- Targeting - Key-value pairs and targeting criteria
- Creatives - Which creatives won the auction
- Line Items - Active line items and their priorities
- Errors - Warnings and error messages
GPT Console Commands
Use these commands in the browser console to debug GPT implementation:
Display All Slots
googletag.pubads().getSlots();
Returns array of all defined ad slots with:
- Slot element ID
- Ad unit path
- Sizes
- Targeting
Get Slot by Element ID
googletag
.pubads()
.getSlots()
.find((slot) => slot.getSlotElementId() === "div-gpt-ad-123456");
Check Slot Targeting
const slot = googletag.pubads().getSlots()[0];
slot.getTargetingKeys().forEach((key) => {
console.log(key, "=", slot.getTargeting(key));
});
Check Page-Level Targeting
googletag
.pubads()
.getTargetingKeys()
.forEach((key) => {
console.log(key, "=", googletag.pubads().getTargeting(key));
});
Network Request Debugging
Inspect Ad Requests
- Open browser DevTools (F12)
- Go to the Network tab
- Filter by
doubleclick.netorgooglesyndication.com - Look for requests to
/gampad/ads
Ad Request Parameters
Key parameters in the ad request URL:
iu=/networkCode/adUnit- Ad unit pathsz=300x250|728x90- Creative sizescust_params- Custom targeting key-values (URL encoded)prev_scp- Previous custom parametersurl- Page URLgdpr- GDPR consent statusgdpr_consent- Consent string
Decode Custom Parameters:
decodeURIComponent("hb_pb%3D1.50%26hb_bidder%3Drubicon");
// Returns: hb_pb=1.50&hb_bidder=rubicon