Created
May 7, 2021 19:14
-
-
Save tdukart/1f66069ae3d0ed16d423ba05c06d5eba to your computer and use it in GitHub Desktop.
Shows the order ID for all DFP-served ads.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
const slots = googletag.pubads().getSlots(); | |
slots.forEach((slot) => { | |
const domId = slot.getSlotId().getDomId(); | |
const campaignId = slot.getResponseInformation().campaignId; | |
const element = document.getElementById(domId); | |
const campaignSpan = document.createElement('span'); | |
campaignSpan.innerHTML = campaignId; | |
element.parentNode.insertBefore(campaignSpan, element); | |
}) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment