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

Add ADSpend bidder adapter #3005

Merged
merged 7 commits into from
Oct 1, 2018
Merged

Conversation

loorke
Copy link
Contributor

@loorke loorke commented Aug 22, 2018

Type of change

  • New bidder adapter
  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Does this change affect user-facing APIs or examples documented on http://prebid.org?
  • Other

Description of change

  • test parameters for validating bids
var adUnits = [
    // Banner
    {
        code: 'any_code',
        mediaTypes: {
            banner: {
                // You can choose one of them
                sizes: [
                  [300, 250],
                  [300, 600],
                  [240, 400],
                  [728, 90],
                  [160, 600],
                ]
            }
        },
        bids: [
            {
                bidder: "adspend",
                params: {
                    // These params is required for getting test banner
                    placement: 'test',
                    tagId: 'test-ad',
                }
            }
        ]
    }
];

pbjs.que.push(() => {
  pbjs.setConfig({
    userSync: {
      syncEnabled: true,
      enabledBidders: ['adspend'],
      pixelEnabled: true,
      syncsPerBidder: 200,
      syncDelay: 100,
    },
    currency: {
      adServerCurrency: 'RUB' // We work only with rubles for now
    }
  });
});

It's a test banner, so you'll see some errors in console cause it will be trying to call our system's events.

Be sure to test the integration with your adserver using the Hello World sample page.

For any changes that affect user-facing APIs or example code documented on http://prebid.org, please provide:

Other information

@mkendall07
Copy link
Member

This pull request introduces 1 alert when merging 5da6ee3 into e1e03db - view on LGTM.com

new alerts:

  • 1 for Superfluous trailing arguments

Comment posted by LGTM.com

@snapwich snapwich self-assigned this Aug 22, 2018
@snapwich snapwich self-requested a review August 22, 2018 17:27
Copy link
Collaborator

@snapwich snapwich left a comment

Choose a reason for hiding this comment

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

Left feedback. This also requires tests, documentation, and probably should have GDPR handling as well.


export const spec = {
code: BIDDER_CODE,
aliases: ['adspend'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

This alias should be removed. The adapter is already known as the "adspend" adapter by filename convention.

const cpm = winObj.cpm;
const event = getWinEvent(requestId).replace(/\$\{AUCTION_PRICE\}/, cpm);

fetch(event);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use regular AJAX requests. fetch is not supported in IE 11. There is an ajax helper function in the core Prebid code.

isBidRequestValid: function(bid) {
const conf = config.getConfig();
return !!(conf.currency &&
conf.currency.adServerCurrency &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

just do config.getConfig('currency.adServerCurrency'). Nested access could potentially throw whereas getConfig uses safe deep access.

},

buildRequests: function(bidRequests, bidderRequest) {
const req = bidRequests[Math.floor(Math.random() * bidRequests.length)];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please explain why you are only responding to random bid requests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made some changes. Do you still have questions?

const conf = config.getConfig();
return !!(conf.currency &&
conf.currency.adServerCurrency &&
bid.crumbs.pubcid &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

The documentation should probably specify somewhere that the pubcid module is required

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean adspendBidAdapter.md file?

const requestId = resp.body.id;

document.cookie =
`on_win_event__${requestId}=${respBid.nurl}; max-age=${COOKIE_EXPIRE}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see you using this cookie in the getWinEvent. Is there something that necessitates this being stored in a cookie rather than just in memory?

Copy link
Contributor Author

@loorke loorke Aug 24, 2018

Choose a reason for hiding this comment

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

No. Looks like you're right, I should store it in memory

@loorke
Copy link
Contributor Author

loorke commented Aug 27, 2018

How can I add GDRP handling?

@snapwich
Copy link
Collaborator

@stale
Copy link

stale bot commented Sep 14, 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 Sep 14, 2018
@mkendall07 mkendall07 self-requested a review September 18, 2018 18:02
@stale stale bot removed the stale label Sep 18, 2018
@mkendall07 mkendall07 assigned mkendall07 and unassigned snapwich Sep 18, 2018
Copy link
Member

@mkendall07 mkendall07 left a comment

Choose a reason for hiding this comment

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

LGTM

@mkendall07 mkendall07 merged commit 29e9b13 into prebid:master Oct 1, 2018
pedrolopezmrf pushed a commit to Marfeel/Prebid.js that referenced this pull request Mar 18, 2019
* Add ADSpend bidder adapter

* Remove superfluous argument and fix bug with sizes

* Change bidder aliases

* Replace fetch with ajax from src/ajax.js

* Store win event URL in memory, not in cookie

* Use getConfig(...) instead of nested access

* Add sending multiple impressions to bidder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants