Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Is there a way to get name of the creative that was Loaded? #3

Closed
treeform opened this issue Jul 15, 2013 · 4 comments
Closed

Is there a way to get name of the creative that was Loaded? #3

treeform opened this issue Jul 15, 2013 · 4 comments
Assignees

Comments

@treeform
Copy link

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?

@mcountis
Copy link
Owner

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.

@treeform
Copy link
Author

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?

@treeform
Copy link
Author

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.

@ghost ghost assigned mcountis Oct 23, 2013
@ptim
Copy link

ptim commented Dec 6, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants