I'm tasked with implementing "prebid" advertising on one of our client sites.

I can do this completely separate of the DFP module but thought this might be something that could be beneficial to others. I was curious if anyone had thoughts as to whether this was something that even belonged in the DFP module or if it should be a sub-module or an entirely new module.

I feel this functionality belongs in the DFP module since prebid is dependent on googletag.

If you read the documentation, or talk to someone from OAO, you'll find that the data needed by each bidder can vary drastically. I feel there should be some standardization...but this is for a different conversation. Because of this, I wanted to implement a group of settings that allows the administrator the ability to add multiple bidders. Take a look at any two bidders, e.g., OpenX vs Optimatic, and you'll see why I'm proposing this solution.

All this is to say - I feel like this could be a great addition to this module if others agree.

Share your thoughts!

Comments

scottalan created an issue. See original summary.

scottalan’s picture

@bleen, Was hoping to get your thoughts on this.

scottalan’s picture

I have to move forward with this either way so I'll probably just build it into the DFP module (7.x-2.x) and provide a patch here.

scottalan’s picture

I did come across https://github.com/heshanlk/prebidjs so maybe I'll reach out and see if this plays well with DFP, namely this branch.

scottalan’s picture

StatusFileSize
new4.22 KB

So I went ahead and added a wrapper for prebid when the ads are rendered. It assumes if the pbjs library is installed then we should use it. I really wanted to create a module that I could contrib back but after having to deal with some of the Bidder Adapters...cough...ix - wtf?? there is apparently no standard on params. I did create a custom module to handle the logic for each of the "bidders" but it's one of those you just slap together to make it work. I decided to create a custom ctools plugin that allows a dev to create a plugin for each of the bidders that will handle setting all the params necessary for each of the slots. Some bidder adapters use a single set of params for each ad and then some change the value of every param. It's freakin' nuts!!!

Anyway, here's a patch that takes care of what needs to happen on DFP's end to allow "easy" integration if someone needs to tackle it.

scottalan’s picture

StatusFileSize
new1.28 KB

We were originally loading dfp_googletag.js as a JS_LIBRARY but should probably just be JS_DEFAULT. This makes it easier for other modules to inject their js before, such as prebid. I'm actively using this configuration and it works.

scottalan’s picture

StatusFileSize
new6.47 KB

I've made some other modifications to dfp_googletag_cmd.js and cleaned it up a bit. I've re-rolled the other patches into this patch. This should be the only patch needed.

scottalan’s picture

StatusFileSize
new6.49 KB

Found a bug so re-rolling the patch with a fix.

scottalan’s picture

StatusFileSize
new35.71 KB

TESTING:

This is a "test" patch that includes a submodule for Prebid.

I'm fighting getting the prebid requests to work every time with lazy loading the ads so removing the lazy loading scroll for now to get some feedback from Ad ops on a live staging site to confirm that are seeing the bids placed properly. I can then go back in and work this back into the original dfp_googltag.cmd.js file and the prebid-request.js file.

scottalan’s picture

StatusFileSize
new38.05 KB

I stripped out all of the functionality that sets the "page level settings" and AdOps wasn't seeing the correct parameters. This patch adds most of those back it but leaves out those that could cause issues with Prebid for now. Once again, this patch is a modified version of the dfp_googletag.cmd.js file and an additional sub-module (prebid).

scottalan’s picture

StatusFileSize
new38.05 KB

This patch is a re-roll of the patch in #10. Updating the version of the prebid.js library to "v1.17.0-pre". This is what we are testing on.

scottalan’s picture

StatusFileSize
new38.79 KB

Adding some configuration to prebid via pbjs.setConfig(). The UserSync config might not apply to everyone so I need to find a better way to add config. Possibly a hook that allows modules to add it to the prebid settings array.

This was necessary to continue testing this setup in a production environment.

scottalan’s picture

StatusFileSize
new38.94 KB

Once again...this is a patch we are using to get a working setup for Prebid. Once we get a baseline using this mangled patch I will begin to work backwards ensuring that I add the lazy load functionality back in.

Modifying the configuration added in the last patch for pbjs.setConfig() and adding the slots back to the global googletag.slots object.

scottalan’s picture

Here's a fully working patch. This is currently being tested on a Live production site that can get between 2-3 million users during peak time!!!

  • This provides a new sub-module -- prebid.
    • This module is responsible for providing a plugin system that allows other modules to define bidders and any custom parameters that are required. While there is room for some clean-up and better documentation, this implementation seemed the only way for developers to customize each bidder. Take a look at the documentation and you'll see just how different each bidder can be.
  • DFP: dfp_googletag.cmd.js
    • This was modified as well to leverage the logic provided by the prebid module, or rather the prebid.dfp.js methods.
    • This only comes into play if the prebid module is enabled.
  • Lazy Loading
    • Lazy loading works! This was a bit of trial and error to get this working.

@bleen, Once I get full sign off that this is solid maybe I can take what I've learned in this implementation and port this to our D8 version as well. If you're interested...

scottalan’s picture

Title: Prebid anyone? » Prebid : Programmatic Advertising
scottalan’s picture

Got some feedback from OAO and it appears there are some issues with some of the ads being lazy loaded. Looking into this issue and will report back with a re-rolled patch to fix this.

scottalan’s picture

Updated patch that should fix the issues with lazy loading ads and prebid.

scottalan’s picture

Re-rolling the patch:

Fixed a few bugs, added more comments, etc.

Added three drush commands for the prebid module:
1. 'drush prebid-clone 1.23.0' => 'Clone the Prebid.js library from Github at tag 1.23.0'
2. 'drush prebid-build ixBidAdapter,openxBidAdapter,rubiconBidAdapter' => 'Build a bundle with these bid adapters.'
3. drush prebid-add-library' => 'Move the generated prebid.js file to libraries.'

Full patch included

thoop@10tv.com’s picture

Scott, thanks for the hard work on this! We are interested in utilizing this solution (and helping with the dev) but running into issues with the patches. It is not able to locate js/dfp_googletag.cmd.js. Any help will be appreciated!

scottalan’s picture

Are you using the 7.x-2.x-dev version of the module? This patch only applies to this branch

thoop@10tv.com’s picture

We made progress with the patch but running into a few bugs in the 2.x code. Digging through that now.

thoop@10tv.com’s picture

Scott, thanks again for this module. We resolved the issue with the 7.x-2.x version of the DFP module. We use infinite scroll on our site so we needed to create unique ids for the adunits. We'll submit that change back once we get the other changes up and running. As for Bidder, we are trying to get Audience Network setup via a plugin but not making much progress. Do you have any examples or documentation on how implement unique networks via plugins? Thanks!

jamaral86’s picture

Small change to prevent throw new error from breaking following code if pbjs object is missing, added console log instead, and enclosed the rest of the code in an else to prevent more errors.

scottalan’s picture

@jamaral86

Thanks will you please open up a new issue and include your patch there.

  • scottalan committed 4ff4617 on 7.x-2.x authored by jamaral86
    Issue #2980845 by scottalan : Prebid : Programmatic Advertising
    
scottalan’s picture

scottalan’s picture

scottalan’s picture

  • scottalan committed 4c05085 on 7.x-2.x
    Issue #2980845 by scottalan : Prebid : Programmatic Advertising
    
  • scottalan committed c88c3cc on 7.x-2.x
    Revert "Issue #2980845 by scottalan : Prebid : Programmatic Advertising...

  • scottalan committed fe69fe5 on 7.x-2.x
    Issue #2980845 by scottalan: Prebid : Programmatic Advertising
    
scottalan’s picture

Status: Active » Reviewed & tested by the community

This has been tested on a Production site for the last 4 months. Going to call this RTBC

vladimiraus’s picture

Assigned: scottalan » Unassigned
Status: Reviewed & tested by the community » Closed (outdated)

Thank you for your contributions.
Drupal 7 is no longer supported.
Closing issue as outdated.