Is there a way to get name of the creative that was Loaded?
Closed this issue · 4 comments
Such as "SummerPromo_Midscale_160x600_stdfla_20130508.swf". No the slot name but the name of the ad creative that might appear in the slot?
Simple answer, no.
Although, binding to "gpt-slot_rendered" you can gain access to the iframes that are rendered as a result.
googletag.cmd.push(function () {
googletag.on("gpt-slot_rendered", function (e, level, message, service, slot, reference) {
var $slot = $('#' + slot.getSlotId().getDomId());
var $adFrame = $slot.find("iframe:not([id*=hidden])");
var adDoc = $adFrame.get(0).contentDocument;
var $image_ad = $("body", adDoc).find('#google_image_div');
if($image_ad.length == 0)
return;
var image_ad_href = $image_ad.find('a').map(function () { return this.href.match(/adurl=([^&"]+)/i)[1] }).get(0);
var image_ad_src = $image_ad.find('img').map(function () { return this.src }).get(0);
/*
process image_ad_href or image_ad_src as you will
*/
});
});
Here I've dug up image creatives. While there is no reference to the name of the line-item or creative that's entered in DFP, the click-url and image are available. I imagine something similar could be done for flash ads.
Thank you for the quick response! Thats very helpful, I all but gave up. Having an image is not as good as creative line-item name but its some thing. While for flash creatives I only get generic wrapper:
<!-- Copyright 2008 DoubleClick, a division of Google Inc. All rights reserved. -->
<!-- Code auto-generated on Mon Jun 24 11:13:50 EDT 2013 -->
<script src="http://s0.2mdn.net/879366/flashwrite_1_2.js"></script>
Do you think there is some thing similar that can be done to flash ads?
Correction, looks like if i wait for a second after getting the gpt-slot_rendered, the flash ad slot fills up with all kinds of useful info including the creative name. Thanks! I think i can use this.
for future googlers: https://developers.google.com/doubleclick-gpt/reference#googletagservice