Giter Site home page Giter Site logo

Comments (17)

lukeshumard avatar lukeshumard commented on June 10, 2024

DFP seems to have updated overnight. Does anyone have access to the documentation for this? I'm trying to patch it ASAP.

from dfp-events.

artyom-d avatar artyom-d commented on June 10, 2024

Hi Luke,
I tried to search for new docs - but couldn't find. Please give me the guidlines of what to search - I'll try to help.

from dfp-events.

lukeshumard avatar lukeshumard commented on June 10, 2024

I can't find them anywhere. message isn't returning as a string, which is why search isn't working. From what I can tell, that block of code needs to find the name of the DFP event, and then trigger the new logger and then return the initial event to the old logger. This means we need to figure out how to get a string for the DFP event happening from that function and whatever arguments are getting passed into it.

from dfp-events.

lukeshumard avatar lukeshumard commented on June 10, 2024

Also, is this even going to work anymore? gpt.js is completely refactored, so does that mean this plugin will need to find new events to hook into?

from dfp-events.

artyom-d avatar artyom-d commented on June 10, 2024

message is now an object and has getMessageId() method, maybe we can use it ?

from dfp-events.

bradleydeutsch avatar bradleydeutsch commented on June 10, 2024

Yeah, getMessageId() replaces the string output. If you match up the logged output in googles console (using ?google_force_console) and then output the message ids with:

for (i in googletag.debug_log.G) {
console.log(googletag.debug_log.G[i].getMessage().getMessageId())
}

You'll see a very distinct pattern - so with regards to dfp-events, just need to change the match value to a number (id)

from dfp-events.

bradleydeutsch avatar bradleydeutsch commented on June 10, 2024

For example:

Google service JS loaded = 8
Associated ([\w]*) service with slot = 40
Completed rendering ad for slot = 6

from dfp-events.

MichaelFBA avatar MichaelFBA commented on June 10, 2024

How do you find the slot number?

from dfp-events.

bradleydeutsch avatar bradleydeutsch commented on June 10, 2024

Ok, so I modified addEvent to:

addEvent = function (name, id, match) {
    events.push({
        "name"  :name,
        "id"    :id,
        "match" :match
    });
};

Events are now:

addEvent("gpt-google_js_loaded",                    8, /Google service JS loaded/ig);
addEvent("gpt-gpt_fetch",                           46, /Fetching GPT implementation/ig);
addEvent("gpt-gpt_fetched",                         48, /GPT implementation fetched\./ig);
addEvent("gpt-page_load_complete",                  1, /Page load complete/ig);
addEvent("gpt-queue_start",                         31, /^Invoked queued function/ig);

addEvent("gpt-service_add_slot",                    40, /Associated ([\w]*) service with slot ([\/\w]*)/ig);
addEvent("gpt-service_add_targeting",               0, /Setting targeting attribute ([\w]*) with value ([\w\W]*) for service ([\w]*)/ig);
addEvent("gpt-service_collapse_containers_enable",  78, /Enabling collapsing of containers when there is no ad content/ig);
addEvent("gpt-service_create",                      35, /Created service: ([\w]*)/ig);
addEvent("gpt-service_single_request_mode_enable",  63, /Using single request mode to fetch ads/ig);

addEvent("gpt-slot_create",                         2, /Created slot: ([\/\w]*)/ig);
addEvent("gpt-slot_add_targeting",                  17, /Setting targeting attribute ([\w]*) with value ([\w\W]*) for slot ([\/\w]*)/ig);
addEvent("gpt-slot_fill",                           50, /Calling fillslot/ig);
addEvent("gpt-slot_fetch",                          3, /Fetching ad for slot ([\/\w]*)/ig);
addEvent("gpt-slot_receiving",                      4, /Receiving ad for slot ([\/\w]*)/ig);
addEvent("gpt-slot_render_delay",                   53, /Delaying rendering of ad slot ([\/\w]*) pending loading of the GPT implementation/ig);
addEvent("gpt-slot_rendering",                      5, /^Rendering ad for slot ([\/\w]*)/ig);
addEvent("gpt-slot_rendered",                       6, /Completed rendering ad for slot ([\/\w]*)/ig);

and the log method:

googletag.debug_log.log = function (level, message, service, slot, reference) {
    var args = Array.prototype.slice.call(arguments),
        e = 0;
    if (message && typeof(message.getMessageId()) === 'number') {
        for (e; e < events.length; e++) {
            if (message.getMessageId() === events[e].id) {
                googletag.trigger(events[e].name, args);
            }
        }
    }
    return old_log.apply(this,arguments);
};

from dfp-events.

bradleydeutsch avatar bradleydeutsch commented on June 10, 2024

Havent figured out value for

Setting targeting attribute ([\w]) with value ([\w\W]) for service ([\w]*)/ig

Yet

from dfp-events.

lukeshumard avatar lukeshumard commented on June 10, 2024

@MichaelFBA
You're going to need to open up your site in your browser like this...
http://www.mywebsite.com/?google_force_console

This will end up displaying the DFP console, and you can click on the tab that says "Page Request". You'll see all of these events being displayed and their timeline as if you were profiling them. If you open up your browser's developer tools and go to the console, you can then run the code that @bradleydeutsch posted above.

for (i in googletag.debug_log.G) {
    console.log(googletag.debug_log.G[i].getMessage().getMessageId())
}

You should get a list of all the event IDs that have fired on your page, it will look like this.
screen shot 2013-10-23 at 2 31 38 pm

If you need further information, try exploring googletag.debug_log, which gave me the following response.
screen shot 2013-10-23 at 2 31 55 pm

from dfp-events.

lukeshumard avatar lukeshumard commented on June 10, 2024

I think the best way to go about this (until there's proper documentation for the events DFP is firing), is to create an array for these events to fire. So gpt-slot_rendering would become events[6].

from dfp-events.

bradleydeutsch avatar bradleydeutsch commented on June 10, 2024

@lukeshumard 8 is /Google service JS loaded/, 5 is /^Rendering ad for slot ([/\w]*)/

from dfp-events.

bradleydeutsch avatar bradleydeutsch commented on June 10, 2024

@lukeshumard do you have any idea what

/Setting targeting attribute ([\w]*) with value ([\w\W]*) for service ([\w]*)/ig

would map to? I don't have any services to setup :)

from dfp-events.

lukeshumard avatar lukeshumard commented on June 10, 2024

@bradleydeutsch thanks for spotting the typo. I'll start working on a patch for this now.

from dfp-events.

lukeshumard avatar lukeshumard commented on June 10, 2024

@bradleydeutsch yeah, i have no idea what to do about that as i've never used it. i imagine once the proper documentation is available, we can take a better approach. for now, any site running DFP and dfp-events.js is breaking, so anything that is slightly functional is better than right now.

from dfp-events.

artyom-d avatar artyom-d commented on June 10, 2024

Thank you, guys. For now everything seems to be working the same way as it was before the GPT refactoring. Can't find Setting targeting too - but I have .setTargeting() in the code, but google console doesn't show this event at all.

from dfp-events.

Related Issues (12)

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.