Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New debugging functionality with bid overrides #2492

Merged
merged 3 commits into from
May 30, 2018

Conversation

snapwich
Copy link
Collaborator

@snapwich snapwich commented May 3, 2018

Type of change

  • Feature

Description of change

This feature adds the ability to override bid responses as they come in or to filter bidders for debugging purposes. The debugging features, when enabled, will stay active for the duration of your session (until you close active tab) or until they are disabled with pbjs.setConfig.

Filtering bidders:

pbjs.setConfig({
  debugging: {
    enabled: true,
    bidders: ['appnexus', 'rubicon']
  }
});

Overwriting bid responses for all bidders:

pbjs.setConfig({
  debugging: {
    enabled: true,
    bids: [{
      cpm: 1.5
    }]
  }
});

Overwriting bid responses for a specific bidder and adUnit code (can use separately)

pbjs.setConfig({
  debugging: {
    enabled: true,
    bids: [{
      bidder: 'rubicon',
      adUnitCode: '/19968336/header-bid-tag-0',
      cpm: 1.5
    }]
  }
});

Disabling debugging

pbjs.setConfig({
  debugging: {
    enabled: false
  }
});

Other information

Original description: https://gist.github.com/bretg/4880f9977a2e49e8a194b701b2e95b67

Using pbjs.setConfig and sessionStorage rather than url strings as encoding JSON for use in URLs is a cumbersome process.

Copy link
Contributor

@idettman idettman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTO

@snapwich snapwich added the needs 2nd review Core module updates require two approvals from the core team label May 4, 2018
@bretg
Copy link
Collaborator

bretg commented May 11, 2018

Need a section in http://prebid.org/dev-docs/toubleshooting-tips.html with an example of how to use this. I assume that the pbjs.setconfig() calls are meant to be called from the console, right? Not practical in the page.

@snapwich
Copy link
Collaborator Author

snapwich commented May 15, 2018

@bretg that's right, you would use pbjs.setConfig from the console to enable/disable your debugging session (which can stick around across page-loads until you disable)

@stale
Copy link

stale bot commented May 29, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 29, 2018
}
}

export function addBidResponseHook(overrides, adUnitCode, bid, next) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting the hook here has the disadvantage of not actually suppressing the network call for the bidder. I think it's ok given that it's probably more complex to turn off the bidder completely. We probably just want to point that out it's not a great option to "disable a bidder".

@stale stale bot removed the stale label May 29, 2018
src/debugging.js Outdated
if (!debugging.enabled) {
disableOverrides();
try {
sessionStorage.removeItem(OVERRIDE_KEY);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you change this to window.sessionStorage ?

@mkendall07
Copy link
Member

LGTM. Nice feature! one small comment.

@snapwich snapwich merged commit 48bd7b8 into prebid:master May 30, 2018
snapwich added a commit that referenced this pull request May 30, 2018
@snapwich snapwich mentioned this pull request Jun 6, 2018
1 task
Pupis pushed a commit to adform/Prebid.js that referenced this pull request Jun 7, 2018
* new debugging functionality with bid overrides

* update name from bidderOverrides to debugging

* change sessionStorage to window.sessionStorage
Pupis pushed a commit to adform/Prebid.js that referenced this pull request Jun 7, 2018
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* new debugging functionality with bid overrides

* update name from bidderOverrides to debugging

* change sessionStorage to window.sessionStorage
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
ghost pushed a commit to devunrulymedia/Prebid.js that referenced this pull request Jan 30, 2019
* new debugging functionality with bid overrides

* update name from bidderOverrides to debugging

* change sessionStorage to window.sessionStorage
ghost pushed a commit to devunrulymedia/Prebid.js that referenced this pull request Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM needs 2nd review Core module updates require two approvals from the core team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants