Skip to content

Instantly share code, notes, and snippets.

View mcallari's full-sized avatar

Michael Callari mcallari

View GitHub Profile
@rdillmanCN
rdillmanCN / getAdData.js
Created December 30, 2017 09:23
This code will display page level targeting and slot level data including sizes, targeting, outOfPage, elementId, advertiserId, campaignId, creativeId, isBackfill, labelIds, lineItemId, outOfPage, sourceAgnosticCreativeId, sourceAgnosticLineItemId, and a URL to this creative at DFP.
/**
* Gathers the page targeting data.
*
* @private
* @param {Object} page - The internal object to append data to.
* @returns {undefined}
*/
function getPageTargeting(page) {
window.googletag.pubads().getTargetingKeys().forEach(function(keys) {
page.pageTargeting[keys] = window.googletag.pubads().getTargeting(keys);