Giter Site home page Giter Site logo

dfp-events's People

Contributors

lukeshumard avatar mcountis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dfp-events's Issues

Licensing

I noticed you haven't declared any license, yet, can you clarify it?

[DO NOT USE] Library will no longer work after Jan 21, 2019

Hello,

I'm an engineer at Google, on the team that maintains gpt.js. Please do not use this library, or rely on hooking into googletag.event_log in any way. It's being removed as part of a code cleanup our team is doing. Any code accessing that property will likely break, since that key will no longer exist.

googletag.event_log is not a public API, and was never meant to be used as such. See the supported API docs here.

Here is the list of events which we officially support:

  • impressionViewable
  • slotVisibilityChanged
  • slotOnload
  • slotRenderEnded

If you have a use case which is not supported by any of these existing events, please file product feedback using the "Send Feedback" button (located in the upper-right corner of our docs page)

Events not firing on Chrome and IE

Hi and thank you for this code.
I just set it up on my development environment, and I was very excited to see it working on Firefox!

But when I tested on Chrome and IE8, the events were not firing. This is how the whole of my DFP related JS looks like:

googletag.cmd.push(function() {

var arr = document.getElementsByTagName('div');
for (var i=0; i<arr.length; i++)
{
    if (arr[i].className == 'gpt-ad')
    {
        var slot_name = arr[i].getAttribute('slot_name');
        var id = arr[i].getAttribute('id');
        var width = parseInt(arr[i].getAttribute('width'));
        var height = parseInt(arr[i].getAttribute('height'));
        var targeting_key = arr[i].getAttribute('targeting_key');
        var targeting_values = arr[i].getAttribute('targeting_values').split("|");
        googletag.defineSlot(slot_name, [width, height], id).addService(googletag.pubads()).setTargeting(targeting_key, targeting_values);
    }
}

googletag.pubads().collapseEmptyDivs();
googletag.enableServices();

var arr = document.getElementsByTagName('div');
for (var i=0; i<arr.length; i++)
{
    if (arr[i].className == 'gpt-ad')
    {
        var id = arr[i].getAttribute('id');
        googletag.cmd.push(function() { googletag.display(id); });
    }
}

if (googletag.on !== undefined && $ !== undefined) {
    googletag.on("gpt-slot_rendered", function(e, level, message, service, slot, reference) {
        var slotId = slot.getSlotId();
        var $slot = $("#" + slotId.getDomId());

        if($slot.find("iframe:not([id*=hidden])")
            .map(function() {
                return this.contentWindow.document;
            })
            .find("body").children().length > 0) {
            $slot.closest('.advertisement').show();
        }
    });
}

});

My ads are in a container called ".advertisement", and it's display:none by default. Then when an ad is rendered, I'm calling .show() on it.

This is because I don't want to display an empty box when there's no ad booked, and I don't have house ads to run.

Anyway, this works great in Firefox, but when I checked in Chrome, the event wasn't firing. I put a breakpoint at $slot.closest('.advertisement').show(); and nothing happened. Same in IE8.

Could you please help me figure out what's wrong?
Thank you!

Logging doesn't seem to work in <= IE8

Hey guys,

It seems calling the extended googletag.debug_log.log() method gets called once and then never again in browsers <= IE8

Any ideas, anyone else seen this?

Ads rendering response time similar to ?googfc

Is it possible to get the loading time and rendering time of creatives in the page using gpt-slot_render_delay or gpt-slot_rendering events ? I have totally four adunits in the page. I wanted to log all the adunit's rendering and loading response time similar to google publisher console's ?googfc does.

Excellent work!

Your code is great -- very clever solution; thank you for sharing it. We're using it to manage the visibility of responsive ad units. At different breakpoints we load different ad sizes, and we hide/show them as appropriate. To keep the number of impressions down (and keep the payload down for the user), we defer the loading of the various ad sizes until they're needed, but GPT forces the visibility of the ad after the async load is complete, which interferes with our visibility management code. Tapping into the rendered event is a perfect way to maintain control over which ad is showing at a given breakpoint!

Events should be built into GPT -- have you spoken with anybody at Google about that? My biggest concern is how fragile this all will be if Google changes their logging tomorrow or next week.

Error message.search is not a function

Hi,

Yesterday I start getting this error at this line:

if(message.search(events[e].match) > -1)

I printed the object "message" and there is no "Search" function available.
Please help.
Thank you in advance.

[REQUEST] publish to npm

useful enhancement to DFP. any chance we can see this on npm? would be easier to manage that way as a 3rd party dependency rather than copying alongside application code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.